[issue37479] IntEnum __format__ behavior can't be overridden through __str__

2019-07-01 Thread Jason Curtis


Change by Jason Curtis :


--
title: IntEnum f-string behavior can't be overridden -> IntEnum __format__ 
behavior can't be overridden through __str__

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 29d6905826d4417426e70f6209ca5e0db7921685 by Benjamin Peterson 
(Miss Islington (bot)) in branch '3.6':
Put pyexpatns.h include back. bpo-37437 (GH-14542)
https://github.com/python/cpython/commit/29d6905826d4417426e70f6209ca5e0db7921685


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37479] IntEnum f-string behavior can't be overridden

2019-07-01 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +14358
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14545

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread miss-islington


miss-islington  added the comment:


New changeset 03b01280825871f6a5bb165fe25d412e33751d45 by Miss Islington (bot) 
in branch '2.7':
Put pyexpatns.h include back. bpo-37437 (GH-14539)
https://github.com/python/cpython/commit/03b01280825871f6a5bb165fe25d412e33751d45


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread miss-islington


miss-islington  added the comment:


New changeset f3130fab9c5cbc7125695dbd66cdc2fd76e20093 by Miss Islington (bot) 
in branch '3.7':
Put pyexpatns.h include back. bpo-37437 (GH-14539)
https://github.com/python/cpython/commit/f3130fab9c5cbc7125695dbd66cdc2fd76e20093


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread miss-islington


miss-islington  added the comment:


New changeset 9bd5479f8aba2687f4b8de735b1de50ef1405f19 by Miss Islington (bot) 
in branch '3.8':
Put pyexpatns.h include back. bpo-37437 (GH-14539)
https://github.com/python/cpython/commit/9bd5479f8aba2687f4b8de735b1de50ef1405f19


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14357
pull_request: https://github.com/python/cpython/pull/14544

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14356
pull_request: https://github.com/python/cpython/pull/14543

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14355
pull_request: https://github.com/python/cpython/pull/14542

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14354
pull_request: https://github.com/python/cpython/pull/14541

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 2cd07920bb7d2d31394092190f37935dc421 by Benjamin Peterson in 
branch 'master':
Put pyexpatns.h include back. bpo-37437 (GH-14539)
https://github.com/python/cpython/commit/2cd07920bb7d2d31394092190f37935dc421


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14353
pull_request: https://github.com/python/cpython/pull/14540

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37437] update vendorized expat to 2.2.7

2019-07-01 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +14352
pull_request: https://github.com/python/cpython/pull/14539

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37465] Incorrect documentation for `s#` arguments in C API argument parsing

2019-07-01 Thread Inada Naoki


Inada Naoki  added the comment:

> Oh! Fair enough, I had missed it. Does the note also involve `Py_BuildValue`? 
> If so, the documentation of `Py_BuildValue` should probably be updated; if 
> not, I think it would be clearer if the note mentioned that it only applies 
> to parsing, not building, values.

Yes, this is same to Py_BuildValue.  The document of Py_BuildValue
should be `int or Py_ssize_t` too.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36390] IDLE: Refactor formatting methods from editor

2019-07-01 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Tabwidth for the Text widget is currently fixed at 8 based on claim in 
editor.py that nothing else works correctly.  It would be nice to verify if 
this is still correct.  If it is, then there would seem to be no need to pass 
it around.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36390] IDLE: Refactor formatting methods from editor

2019-07-01 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I think get_indent(line) is much clearer than classifyws(s)???.  I propose to 
merge PR 12481 first, after review, with tests, and then include name change 
with rewrite in PR 14500.  Proposed docstring:
"Return line indent as # chars and effective # of spaces."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37480] add ptpython to list of alternate interpreters

2019-07-01 Thread Zach Valenta


Change by Zach Valenta :


--
keywords: +patch
pull_requests: +14351
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14538

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37480] add ptpython to list of alternate interpreters

2019-07-01 Thread Zach Valenta


New submission from Zach Valenta :

Referring to the last paragraph of chapter 14 of the tutorial on interactive 
interpreters: 

https://docs.python.org/3/tutorial/interactive.html#alternatives-to-the-interactive-interpreter

Despite personally using bpython, ptpython seems both mature and popular enough 
to merit inclusion in the docs. Plus, bpython recommends them :)

--
assignee: docs@python
components: Documentation
messages: 347099
nosy: docs@python, zjayv
priority: normal
severity: normal
status: open
title: add ptpython to list of alternate interpreters
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37436] os.path.isfile() with big number cause OverflowError: fd is greater than maximum

2019-07-01 Thread Zufu Liu


Zufu Liu  added the comment:

Please also consider following pieces of code.
They (value of int sub classes) can't be returned by fileno().

Python 3.8.0b1 (tags/v3.8.0b1:3b5deb0116, Jun  4 2019, 19:52:55) [MSC v.1916 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class MyInt(int):pass
...
>>> a=MyInt(6)
>>> a
6
>>> import os.path
>>> os.path.isfile(a)
False
>>> os.path.isfile(True)
False
>>> os.path.isfile(False)
False
>>>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37479] IntEnum f-string behavior can't be overridden

2019-07-01 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
nosy: +ethan.furman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37436] os.path.isfile() with big number cause OverflowError: fd is greater than maximum

2019-07-01 Thread Zufu Liu


Zufu Liu  added the comment:

Personally I prefer TypeError. Use file descriptor is rare, I never used it in 
Python script.
I encountered this because arguments passed in wrong order in my function, then 
I passed the wrong argument to isfile() without checking.
Make isfile() returns False would make it harder to find bugs in user program.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37479] IntEnum f-string behavior can't be overridden

2019-07-01 Thread Eric V. Smith


Eric V. Smith  added the comment:

Note that this isn't really related to f-strings, except that they use the 
__format__ protocol, as does str.__format__.

>>> format(myIntEnum.x)
'1'

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22107] tempfile module misinterprets access denied error on Windows

2019-07-01 Thread Eryk Sun


Eryk Sun  added the comment:

CanAccessFolder is incomplete for the following reasons:

(1) It doesn't account for SeBackupPrivilege (read and execute access) and 
SeRestorePrivilege (write and delete access). If a create or open call requests 
backup semantics, these two privileges are checked by the I/O Manager in order 
to grant access before the request is sent to the filesystem device stack. That 
said, our os.open() call doesn't use O_OBTAIN_DIR (0x2000), an undocumented 
flag that allows opening a directory by requesting backup semantics. If it did 
use this undocumented flag, there would actually be no problem to solve since 
we would get FileExistsError instead of PermissionError.

(2) It doesn't check the parent directory in case FILE_READ_ATTRIBUTES access 
(required for GENERIC_READ) or DELETE access (required for GENERIC_ALL) are 
either not granted or denied to the user for the target directory. These rights 
are granted by NT filesystem policy if FILE_READ_DATA and FILE_DELETE_CHILD 
access are granted to the parent directory, respectively. This is a general 
concern that's not relevant here since we only need to check the directory for 
write access (i.e. FILE_ADD_FILE).

(3) It doesn't get the LABEL_SECURITY_INFORMATION from the file security, in 
order to check for no-read-up, no-write-up, and no-execute-up mandatory access. 
Adding files to a directory is disallowed if its mandatory label denies 
write-up access and its integrity level is higher than the caller's (e.g. the 
caller is a standard user at medium integrity level, and the directory is at 
high or system integrity level).

(4) It doesn't check effective access via OpenThreadToken, in case the thread 
is impersonating.

(5) It cannot take into account access granted or denied by filesystem filter 
drivers such as antimalware programs. For this, we need to actually try to open 
the directory with the requested access via CreateFile. We're granted the 
required access if CreateFile succeeds, or if it fails with a sharing violation 
(i.e. winerror 32). A sharing violation isn't an issue since in practice adding 
a file to a directory is internal to a filesystem; it doesn't count against 
shared data access.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37363] Additional PEP578 hooks

2019-07-01 Thread Steve Dower


Steve Dower  added the comment:

All that's left here right now is some xmlrpc events, unless we can think of 
any more stdlib modules that should have them?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37479] IntEnum f-string behavior can't be overridden

2019-07-01 Thread Jason Curtis


Jason Curtis  added the comment:

related cPython code: 
https://github.com/python/cpython/blob/19a1e1eb86115db66c1faae5927f87e3a12692fc/Lib/enum.py#L626

If we're in a mixed-in class but the class has overridden __str__(), we should 
probably use str(self) instead of self._value_.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37390] Generate table of audit events for docs

2019-07-01 Thread Steve Dower


Steve Dower  added the comment:

I can't repro this. It looks like Doc/makefile#L196 passes -Ea which ought to 
deal with any old files (and it certainly does on my Ubuntu machine), so it's 
likely not that.

The table contents is simply not in the file on docs.p.o, so I guess there's 
something in the build process that's failing? Or the environment is not making 
it to the output stage for some reason?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19696] Merge all (non-syntactic) import-related tests into test_importlib

2019-07-01 Thread Kyle Stanley


Kyle Stanley  added the comment:

Created a new PR for moving the last two files "test_threaded_import.py" and 
"threaded_import_hangers.py" to the directory "test_importlib". 
(https://github.com/python/cpython/pull/14537)

There were some issues with automatically merging the changes, was the conflict 
because I attempted to move two files in a single PR? The previous one (which 
was just moving a single file) did not have any issues with merge conflicts.

This should be the final PR required for this issue, afterwards I'll look into 
creating a new issue for modernizing the tests.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19696] Merge all (non-syntactic) import-related tests into test_importlib

2019-07-01 Thread Kyle Stanley


Change by Kyle Stanley :


--
pull_requests: +14350
pull_request: https://github.com/python/cpython/pull/14537

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37479] IntEnum f-string behavior can't be overridden

2019-07-01 Thread Jason Curtis


Jason Curtis  added the comment:

I mistyped - __str__ can be overridden effectively, but __format__ has to be 
overridden instead or overridden also to get the desired f-string behavior.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37479] IntEnum f-string behavior can't be overridden

2019-07-01 Thread Jason Curtis


New submission from Jason Curtis :

Combining int and Enum, as with enum.IntEnum results in a class where __str__ 
cannot be effectively overridden. For example:


from enum import IntEnum

class myIntEnum(IntEnum):
x = 1

def __str__(self):
return 'AAAa'

f'{myIntEnum.x}, {str(myIntEnum.x)}'


Expected output:
'AAAa, AAAa'

Actual output:
'1, AAAa'

Overriding __str__ in this way works as expected if the inherited classes are 
int or Enum individually. However, it does not work when inheriting (int, Enum) 
or when inheriting (intEnum).

Presumably this is a side effect of Enum's mixin behavior documented at 
https://docs.python.org/3/library/enum.html#others and it is possibly related 
to https://bugs.python.org/issue18264 .

--
components: Library (Lib)
messages: 347089
nosy: Jason Curtis
priority: normal
severity: normal
status: open
title: IntEnum f-string behavior can't be overridden
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37363] Additional PEP578 hooks

2019-07-01 Thread miss-islington


miss-islington  added the comment:


New changeset 746992c1ae4c632220563d3fe54123498f93db1d by Miss Islington (bot) 
in branch '3.8':
bpo-37363: Add audit events on startup for the run commands (GH-14524)
https://github.com/python/cpython/commit/746992c1ae4c632220563d3fe54123498f93db1d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19960] zlib skipped when building 2.7 on macOS without /usr/include installed

2019-07-01 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19960] zlib skipped when building 2.7 on macOS without /usr/include installed

2019-07-01 Thread Ned Deily


Ned Deily  added the comment:


New changeset da7f6dbbf52fe7074360a9eae918806da60139c5 by Ned Deily in branch 
'2.7':
bpo-19960: Fix building of zlib on macOS without installed headers (GH-14257)
https://github.com/python/cpython/commit/da7f6dbbf52fe7074360a9eae918806da60139c5


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37478] Docs: Method os.chdir() does not mention errors that can be raised

2019-07-01 Thread Kyle Stanley


Kyle Stanley  added the comment:

Minor clarifications:

This change is referring to the "Files and Directories" section of the "os.rst" 
page in "cpython/Doc/library/os.rst".

Also, I realized that I forgot to add the colon before "exc" in a couple 
locations. This was just a typo when writing the comment, it is correctly 
formatted in my local branch.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37363] Additional PEP578 hooks

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14349
pull_request: https://github.com/python/cpython/pull/14536

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37363] Additional PEP578 hooks

2019-07-01 Thread Steve Dower


Steve Dower  added the comment:


New changeset e226e83d36dfc7220d836fb7a249ce18e70cb4a6 by Steve Dower in branch 
'master':
bpo-37363: Add audit events on startup for the run commands (GH-14524)
https://github.com/python/cpython/commit/e226e83d36dfc7220d836fb7a249ce18e70cb4a6


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31783] Race condition in ThreadPoolExecutor when scheduling new jobs while the interpreter shuts down

2019-07-01 Thread Ned Deily


Ned Deily  added the comment:

Yes, you can still add the backport labels even after the original PR has been 
merged.  It's magic!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31783] Race condition in ThreadPoolExecutor when scheduling new jobs while the interpreter shuts down

2019-07-01 Thread Brian Quinlan


Brian Quinlan  added the comment:

Can I add "needs backport to 3.8" and "needs backport to 3.7" labels now or
do I have to use cherry_picker at this point?

On Mon, Jul 1, 2019 at 3:55 PM Ned Deily  wrote:

>
> Ned Deily  added the comment:
>
> > I don't know what the backport policy is.
>
> It does seem that the devguide does not give much guidance on this; I've
> opened an issue about it (https://github.com/python/devguide/issues/503).
> But, in general, if the fix is potentially beneficial and does not add
> undue risk or an incompatibility, we would generally consider backporting
> it to the currently active maintenance branches; at the moment, that would
> be 3.8 (in beta phase) and 3.7 (maintenance nmode).  We have a lot of
> buildbot tests that show non-deterministic failures, some possibly due to
> concurrent.futures.  If there is a chance that this fix might mitigate
> those, I'd like to consider it for backporting.
>
> --
>
> ___
> Python tracker 
> 
> ___
>
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31783] Race condition in ThreadPoolExecutor when scheduling new jobs while the interpreter shuts down

2019-07-01 Thread Ned Deily


Ned Deily  added the comment:

> I don't know what the backport policy is.

It does seem that the devguide does not give much guidance on this; I've opened 
an issue about it (https://github.com/python/devguide/issues/503).  But, in 
general, if the fix is potentially beneficial and does not add undue risk or an 
incompatibility, we would generally consider backporting it to the currently 
active maintenance branches; at the moment, that would be 3.8 (in beta phase) 
and 3.7 (maintenance nmode).  We have a lot of buildbot tests that show 
non-deterministic failures, some possibly due to concurrent.futures.  If there 
is a chance that this fix might mitigate those, I'd like to consider it for 
backporting.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37475] What is urllib.request.urlcleanup() function?

2019-07-01 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

Hi Victor and Karthikeyan,

Both your analysis are correct.

- This is a legacy interface, present purely for satisfying the old code, when 
urlretrieve was advertised as the first/easy to way to use urllib and download 
something.

- At this moment, I think, we should remove those legacy interfaces including 
urlcleanup. 

- I think, users can easily using urllib to write to the file using context 
manager and if desired urlretrieve can be modernized over it's use of 
urlcleanup.

+1 to deprecation and removal.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37199] Test suite fails when Ipv6 is unavailable

2019-07-01 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +14348
pull_request: https://github.com/python/cpython/pull/14535

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37478] Docs: Method os.chdir() does not mention errors that can be raised

2019-07-01 Thread Kyle Stanley


New submission from Kyle Stanley :

In the section describing the functionality of os.chdir(), there is no mention 
of possible errors that can be raised. This differentiates significantly from 
the sections of other methods, such as os.is_dir():

"This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but 
:exc:`FileNotFoundError` is caught and not raised."

For the purpose of consistency and providing additional useful information, I 
would suggest doing the same for os.chdir(). os.chdir() differs from 
os.is_dir() by directly raising the OSErrors FileNotFoundError and 
NotADirectoryError rather than handling them. I would suggest the addition of 
the following in os.chdir()'s section:

"This method can raise :exc:`OSError`, such as exc:`FileNotFoundError` if the 
*path* does not lead to a valid file or exc:`NotADirectoryError` if the file 
specified is not a valid directory."

or a less verbose alternative:

"This method can raise :exc:`OSError`, such as exc:`FileNotFoundError` and 
exc:`NotADirectoryError`."

If a user is reading the documentation, they might naturally assume that 
os.chdir() catches the FileNotFoundError, similar to the behavior in 
os.is_dir(). Also, the NotADirectoryError is not explicitly mentioned anywhere 
else on the "os.rst" page. If it were to be mentioned anywhere, os.chdir() 
would probably be the most relevant location to do so.

Also, as a general question, what exactly is the standard for mentioning errors 
in the method sections for the Python documentation? For the purposes of 
clarity, I think it would be quite useful to explicitly mention errors, and a 
brief description of situations which raise them. If the behavior of the errors 
is consistent across of a group of methods, it can instead be mentioned in the 
header section. 

However, if the behavior not consistent, such as in this case, I think it is 
useful to briefly mention how the method deviates. It also seems useful to 
mention the error at least once if it is not explicitly mentioned elsewhere on 
the page, even if the parent is mentioned, such as with NotADirectoryError and 
OSError. This seems to be particularly important to do for the docs in a 
language such as Python, as it does not require the raise-able/throw-able 
errors to be mentioned in the code. 

I have already created a branch in my local fork of the cpython repository 
which implements this change, but I'll await feedback before submitting the PR.

--
assignee: docs@python
components: Documentation
messages: 347080
nosy: aeros167, docs@python
priority: normal
severity: normal
status: open
title: Docs: Method os.chdir() does not mention errors that can be raised
type: enhancement
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37456] FAQ says positional arguments aren't a thing

2019-07-01 Thread SoniEx2


SoniEx2  added the comment:

no thanks, I don't like signing CLAs.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31783] Race condition in ThreadPoolExecutor when scheduling new jobs while the interpreter shuts down

2019-07-01 Thread Brian Quinlan


Brian Quinlan  added the comment:

I don't know what the backport policy is. The bug is only theoretical AFAIK
i.e. someone noticed it through code observation but it has not appeared in
the wild.

On Mon, Jul 1, 2019 at 3:25 PM Ned Deily  wrote:

>
> Ned Deily  added the comment:
>
> Brian, should this fix be backported to 3.8 and 3.7?  As it stands now, it
> will only be showing up in Python 3.9 unless you add the backport labels to
> the original PR.  Unless it cna be shown to be a security issue, it would
> not be appropriate to backport to 3.6 at this stage.
>
> --
> nosy: +ned.deily
>
> ___
> Python tracker 
> 
> ___
>
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31783] Race condition in ThreadPoolExecutor when scheduling new jobs while the interpreter shuts down

2019-07-01 Thread Ned Deily


Ned Deily  added the comment:

Brian, should this fix be backported to 3.8 and 3.7?  As it stands now, it will 
only be showing up in Python 3.9 unless you add the backport labels to the 
original PR.  Unless it cna be shown to be a security issue, it would not be 
appropriate to backport to 3.6 at this stage.

--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37477] NamedTemporaryFile can hang on windows

2019-07-01 Thread Martin Panter


Change by Martin Panter :


--
resolution:  -> duplicate
superseder:  -> tempfile module misinterprets access denied error on Windows

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22107] tempfile module misinterprets access denied error on Windows

2019-07-01 Thread Erik Aronesty


Erik Aronesty  added the comment:

Series of operations needed to answer the questions os.access is not answering 
on windows:

bool CanAccessFolder( LPCTSTR folderName, DWORD genericAccessRights )
{
bool bRet = false;
DWORD length = 0;
if (!::GetFileSecurity( folderName, OWNER_SECURITY_INFORMATION | 
GROUP_SECURITY_INFORMATION 
| DACL_SECURITY_INFORMATION, NULL, NULL,  ) && 
ERROR_INSUFFICIENT_BUFFER == ::GetLastError()) {
PSECURITY_DESCRIPTOR security = static_cast< PSECURITY_DESCRIPTOR >( 
::malloc( length ) );
if (security && ::GetFileSecurity( folderName, 
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION
| DACL_SECURITY_INFORMATION, security, length, 
 )) {
HANDLE hToken = NULL;
if (::OpenProcessToken( ::GetCurrentProcess(), TOKEN_IMPERSONATE | 
TOKEN_QUERY | 
TOKEN_DUPLICATE | STANDARD_RIGHTS_READ,  )) {
HANDLE hImpersonatedToken = NULL;
if (::DuplicateToken( hToken, SecurityImpersonation, 
 )) {
GENERIC_MAPPING mapping = { 0x };
PRIVILEGE_SET privileges = { 0 };
DWORD grantedAccess = 0, privilegesLength = sizeof( 
privileges );
BOOL result = FALSE;
 
mapping.GenericRead = FILE_GENERIC_READ;
mapping.GenericWrite = FILE_GENERIC_WRITE;
mapping.GenericExecute = FILE_GENERIC_EXECUTE;
mapping.GenericAll = FILE_ALL_ACCESS;
 
::MapGenericMask( ,  );
if (::AccessCheck( security, hImpersonatedToken, 
genericAccessRights, 
, , , 
,  )) {
bRet = (result == TRUE);
}
::CloseHandle( hImpersonatedToken );
}
::CloseHandle( hToken );
}
::free( security );
}
}
 
return bRet;
}

--
nosy: +earonesty

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37477] NamedTemporaryFile can hang on windows

2019-07-01 Thread Erik Aronesty


Erik Aronesty  added the comment:

yes, duplicate of https://bugs.python.org/issue22107 ... tried looking first, 
sry.

--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37477] NamedTemporaryFile can hang on windows

2019-07-01 Thread Martin Panter


Martin Panter  added the comment:

Perhaps a duplicate of Issue 22107?

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37477] NamedTemporaryFile can hang on windows

2019-07-01 Thread Erik Aronesty


Change by Erik Aronesty :


--
type:  -> crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37477] NamedTemporaryFile can hang on windows

2019-07-01 Thread Erik Aronesty


New submission from Erik Aronesty :

Depending on the user's permissions, this code can hang, instead of raising an 
exception:

from tempfile import NamedTemporaryFile
NamedTemporaryFile(dir="/")

The problamatic code is in tempfile.py:

When encountering a "[Errno 13] Permission denied: '/tmpmcupmo_g'", the current 
code uses _os.access(dir, _os.W_OK) in two places to check if access is allowed 
to write to the directory.

On windows, _os.access does not check if the user has permission to write to 
the folder, it only checks if the folder is read-only (and it doesn't even do a 
good job at that).

So the temp file creator loops for a rather long time, and consumes a massive 
amount of system resources, because os.TMP_MAX on modern windows versions is 
2147483647.

This article explains how to check if a directory can-write without trying to 
write to it:

http://blog.aaronballman.com/2011/08/how-to-check-access-rights/

Alternatively, a more careful check of the winerror return value from the open 
call *might* be sufficient.

--
messages: 347073
nosy: earonesty
priority: normal
severity: normal
status: open
title: NamedTemporaryFile can hang on windows
versions: Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37470] Make it explicit what happens when using a bounded queue with QueueHandler

2019-07-01 Thread Vinay Sajip


Change by Vinay Sajip :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37470] Make it explicit what happens when using a bounded queue with QueueHandler

2019-07-01 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 91f9f098fcdb023dbb89d06c8833e89a11cbae4c by Vinay Sajip (Miss 
Islington (bot)) in branch '3.8':
bpo-37470: Document more clearly the error handling for QueueHandler.emit(). 
(GH-14532) (GH-14533)
https://github.com/python/cpython/commit/91f9f098fcdb023dbb89d06c8833e89a11cbae4c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37470] Make it explicit what happens when using a bounded queue with QueueHandler

2019-07-01 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 844a9d64a4f640d1b20dc6ea54ab375680332d93 by Vinay Sajip (Miss 
Islington (bot)) in branch '3.7':
bpo-37470: Document more clearly the error handling for QueueHandler.emit(). 
(GH-14532) (GH-14534)
https://github.com/python/cpython/commit/844a9d64a4f640d1b20dc6ea54ab375680332d93


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37462] Default starting directory for os.walk()

2019-07-01 Thread Kyle Stanley


Kyle Stanley  added the comment:

Oh okay thanks taleinat. I wasn't aware of the existence of the ideas mailing 
list, I'll have to check that out next time.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36881] isinstance raises TypeError for metaclass with metaclass=ABCMeta

2019-07-01 Thread Caleb Donovick


Change by Caleb Donovick :


--
nosy: +donovick

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37470] Make it explicit what happens when using a bounded queue with QueueHandler

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14346
pull_request: https://github.com/python/cpython/pull/14533

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37470] Make it explicit what happens when using a bounded queue with QueueHandler

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14347
pull_request: https://github.com/python/cpython/pull/14534

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37470] Make it explicit what happens when using a bounded queue with QueueHandler

2019-07-01 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 0f4e8132820947d93eccf31b9e526b81c6ffa53d by Vinay Sajip in branch 
'master':
bpo-37470: Document more clearly the error handling for QueueHandler.emit(). 
(GH-14532)
https://github.com/python/cpython/commit/0f4e8132820947d93eccf31b9e526b81c6ffa53d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37390] Generate table of audit events for docs

2019-07-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Strange, I bet that I have seen this rendered table while the issue was closed. 
The docs table renders fine locally on latest master. Given that Audit event, 
Arguments and References table header are rendered with the table being 
replaced I guess somehow env.all_audit_events is empty. Is there something 
related to storing it with env? I hope docs CI to generate html daily is also 
done in a clean state like locally. Is it possible to get archives of docs 
releases to see from when this was missing as in 
https://docs.python.org/3.9/download.html

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37475] What is urllib.request.urlcleanup() function?

2019-07-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I have added Senthil for thoughts. The temporary files is also stored in a 
module level variable. Looking into the git history there were some changes in 
e24f96a05973ddbb59d88c03570aef8545c5ef10 . The function is also marked as 
legacy in __all__ with compat code in 2to3. urlcleanup also sets the global 
variable _opener to None so it does the extra work of uninstalling the global 
variable opener set by install_opener which is also not documented.

urlretrieve enables retrieving and storing the content in a temporary file to 
return (tempfilename, headers) to be read later. In case the user doesn't give 
a filename it implicitly creates a temporary file. There is similar code in 
urllib.request.URLopener().retrieve [0] too where the temporary files are 
created implicitly but __del__ is overridden where the temp files are deleted 
as the program exits. I think it's better to ask the user to give filename and 
so that the user is responsible for the file but since the behavior is present 
for a long time there is backwards compatibility in changing this and there 
might be some code depending on the implicit temporary file created as a 
feature. 

One possible way would be to have a wrapper class that creates the temporary 
file when not given and then deletes it or calls urlcleanup on __del__ to clean 
it up as the GC is called like URLopener.retrieve? This would be done only when 
user doesn't give a file and for the temporary files generated by urlretrieve.


[0] 
https://github.com/python/cpython/blob/67310023f299b5a2fad71fca449b46d280036690/Lib/urllib/request.py#L1702

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37470] Make it explicit what happens when using a bounded queue with QueueHandler

2019-07-01 Thread Vinay Sajip


Change by Vinay Sajip :


--
keywords: +patch
pull_requests: +14345
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14532

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37439] Add random.binomialvariate()

2019-07-01 Thread Mark Dickinson


Mark Dickinson  added the comment:

> [...] and then making algorithmic improvements later.

Though thinking about it, there is *one* catch: for the random module, it's 
nice if reproducibility isn't broken more often than necessary in released 
versions, so it would be best to do any algorithmic tweaking *before* 3.9.0 is 
released. But that still gives us some time ...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37450] Generalize Euclidean distance function in the math module to Minkowski distance

2019-07-01 Thread Mark Dickinson


Mark Dickinson  added the comment:

Agreed. We've moved away from the "Python's math module is just a set of 
wrappers around the C math library" stage, but it's still important to keep the 
math module a coherent set of basic building blocks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37390] Generate table of audit events for docs

2019-07-01 Thread Steve Dower


Steve Dower  added the comment:

The page is not generating correctly at 
https://docs.python.org/dev/library/audit_events.html

Adding the documentation team, where hopefully someone will know what needs 
poking.

--
nosy: +eric.araujo, ezio.melotti, mdk, willingc
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37469] Make it explicit that logging QueueHandler / QueueListener accepts a SimpleQueue.

2019-07-01 Thread Vinay Sajip


Change by Vinay Sajip :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37469] Make it explicit that logging QueueHandler / QueueListener accepts a SimpleQueue.

2019-07-01 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 6cde61369e8174c493ca240cb52ebc9c2a2fe667 by Vinay Sajip (Miss 
Islington (bot)) in branch '3.8':
bpo-37469: Document usability of SimpleQueue with QueueHandler and 
QueueListener. (GH-14521) (GH-14525)
https://github.com/python/cpython/commit/6cde61369e8174c493ca240cb52ebc9c2a2fe667


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37469] Make it explicit that logging QueueHandler / QueueListener accepts a SimpleQueue.

2019-07-01 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset b0ab95bbe792b38e952688f8fa1657a78b35410e by Vinay Sajip (Miss 
Islington (bot)) in branch '3.7':
bpo-37469: Document usability of SimpleQueue with QueueHandler and 
QueueListener. (GH-14521) (GH-14526)
https://github.com/python/cpython/commit/b0ab95bbe792b38e952688f8fa1657a78b35410e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37439] Add random.binomialvariate()

2019-07-01 Thread Mark Dickinson


Mark Dickinson  added the comment:

@avi That's Raymond's call, but IMO there's absolutely nothing wrong with 
getting a reference implementation (with tests, documentation, and all the 
usual trimmings) in first and then making algorithmic improvements later. 

Thanks for the PR!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37456] FAQ says positional arguments aren't a thing

2019-07-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Hi,

Would you like to do a PR updating it?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37476] Adding a unit test of unicode in test_unicode.py

2019-07-01 Thread hai shi


Change by hai shi :


--
keywords: +patch
pull_requests: +14344
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14531

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37476] Adding a unit test of unicode in test_unicode.py

2019-07-01 Thread hai shi


New submission from hai shi :

As title, Adding a unit test of unicode in test_unicode.py.

--
components: Tests
messages: 347059
nosy: shihai1991
priority: normal
severity: normal
status: open
title: Adding a unit test of unicode in test_unicode.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36763] Implementation of the PEP 587

2019-07-01 Thread miss-islington


miss-islington  added the comment:


New changeset 4c227e6a56a9704fe5b4e4509071796f3359f4bb by Miss Islington (bot) 
in branch '3.8':
bpo-36763: Use PyConfig_Clear() (GH-14445)
https://github.com/python/cpython/commit/4c227e6a56a9704fe5b4e4509071796f3359f4bb


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37475] What is urllib.request.urlcleanup() function?

2019-07-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +orsenthil

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37468] Don't install wininst*.exe on non-Windows platforms

2019-07-01 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +dstufft, eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37439] Add random.binomialvariate()

2019-07-01 Thread Avinash Sajjanshetty


Avinash Sajjanshetty  added the comment:

@Mark - Newb here and before I could see your reply, I sent a PR cos I thought 
simple implementation provided by Raymond Hettinger was good enough. Shall I 
update the PR? 

I will add the tests soon.

--
nosy: +avi

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37439] Add random.binomialvariate()

2019-07-01 Thread Avinash Sajjanshetty


Change by Avinash Sajjanshetty :


--
keywords: +patch
pull_requests: +14343
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14530

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37475] What is urllib.request.urlcleanup() function?

2019-07-01 Thread STINNER Victor


New submission from STINNER Victor :

While working on bpo-37421 "Some tests leak temporary files", I had to write PR 
14529 fix: test_urllib urlretrieve() tests now explicitly call urlcleanup() to 
remove temporary files.

If urlretrieve() caller forgets to remove the temporary file, the "temporary" 
file is left in the temporary directory, until this directory is cleared which 
may happen soon (next reboot?) or not.

When ContentTooShortError is raised, the temporary file is left in the 
temporary directory: the caller must call urlcleanup() explicitly. It sounds 
like a bug to me.

Is it really a good API if urlcleanup() must be called explicitly? I dislike 
having a "separated" function for the cleanup, whereas Python could rely on 
object lifetime to do the cleanup.

Should we deprecate this API in favor of a better urllib API?

--
components: Library (Lib)
messages: 347056
nosy: vstinner, xtreak
priority: normal
severity: normal
status: open
title: What is urllib.request.urlcleanup() function?
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37439] Add random.binomialvariate()

2019-07-01 Thread Mark Dickinson


Mark Dickinson  added the comment:

If you want to be able to switch to something more efficient for large `n`, 
Knuth describes a simple O(log(n)) algorithm in TAOCP volume 4 (and attributes 
it to J. H. Ahrens). It's essentially a bisection search on the value, using 
the fact that we can use the beta distribution to generate order statistics. 
Here's a (too) simple Python implementation. It still needs thorough testing, 
and could be optimised in many ways - e.g., using sensible crossover point for 
n and not recursing all the way to n = 0.


def binomialvariate(n, p):
if n == 0:
return 0
a, b = (1 + n)//2, 1 + n//2
x = betavariate(a, b)
if x < p:
return a + binomialvariate(b - 1, (p - x)/(1 - x))
else:
return binomialvariate(a - 1, p/x)


>>> binomialvariate(10**10, 0.5)
444649

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37221] PyCode_New API change breaks backwards compatibility policy

2019-07-01 Thread Stefan Behnel


Stefan Behnel  added the comment:

> Is it part of Cython 0.29.11 released yesterday?

Yes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37421] Some tests leak temporary files

2019-07-01 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +14342
pull_request: https://github.com/python/cpython/pull/14529

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36763] Implementation of the PEP 587

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14341
pull_request: https://github.com/python/cpython/pull/14528

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36763] Implementation of the PEP 587

2019-07-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 67310023f299b5a2fad71fca449b46d280036690 by Victor Stinner in 
branch 'master':
bpo-36763: Use PyConfig_Clear() (GH-14445)
https://github.com/python/cpython/commit/67310023f299b5a2fad71fca449b46d280036690


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37421] Some tests leak temporary files

2019-07-01 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +14340
pull_request: https://github.com/python/cpython/pull/14527

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37469] Make it explicit that logging QueueHandler / QueueListener accepts a SimpleQueue.

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14339
pull_request: https://github.com/python/cpython/pull/14526

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37469] Make it explicit that logging QueueHandler / QueueListener accepts a SimpleQueue.

2019-07-01 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset e6b64b756f940147728ea7808fb686ffcae89176 by Vinay Sajip in branch 
'master':
bpo-37469: Document usability of SimpleQueue with QueueHandler and 
QueueListener. (GH-14521)
https://github.com/python/cpython/commit/e6b64b756f940147728ea7808fb686ffcae89176


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37469] Make it explicit that logging QueueHandler / QueueListener accepts a SimpleQueue.

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14338
pull_request: https://github.com/python/cpython/pull/14525

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36763] Implementation of the PEP 587

2019-07-01 Thread STINNER Victor


STINNER Victor  added the comment:

Another minor implementation issue: calling _PyCoreConfig_Read() twice calls 
_Py_SetArgcArgv() twice, the second call override the first _Py_SetArgcArgv() 
call. IMHO it should only be called once, at the first _PyCoreConfig_Read() 
call.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36763] Implementation of the PEP 587

2019-07-01 Thread miss-islington


miss-islington  added the comment:


New changeset 96f581cf9d2f1d7888d2fd9bb89f19f10c0477bf by Miss Islington (bot) 
in branch '3.8':
bpo-36763: Add PyConfig_SetWideStringList() (GH-1)
https://github.com/python/cpython/commit/96f581cf9d2f1d7888d2fd9bb89f19f10c0477bf


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36763] Implementation of the PEP 587

2019-07-01 Thread STINNER Victor


STINNER Victor  added the comment:

About the documentation: https://docs.python.org/dev/c-api/init.html doesn't 
link to http://docs.python.org/dev/c-api/init_config.html

The first doc should mention somewhere the new doc.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37474] Should Py_Initialize() control the floating point mode?

2019-07-01 Thread STINNER Victor


New submission from STINNER Victor :

Just after calling _PyRuntime_Initialize(), Py_Main() calls:

/* 754 requires that FP exceptions run in "no stop" mode by default,
 * and until C vendors implement C99's ways to control FP exceptions,
 * Python requires non-stop mode.  Alas, some platforms enable FP
 * exceptions by default.  Here we disable them.
 */
#ifdef __FreeBSD__
fedisableexcept(FE_OVERFLOW);
#endif

It's done before calling Py_Initialize(). So applications embedding Python 
don't call it. But "customized Python" which call the new Py_RunMain() with 
Py_InititializeFromConfig() will not call it neither.

I would like to know if this setup code should be moved into Py_Initialize()? 
Especially into the new PyConfig API:
https://docs.python.org/dev/c-api/init_config.html

PyConfig got 2 flags to control parameters which affect the whole process:

* configure_c_stdio
* configure_locale

What is the behavior on FreeBSD when fedisableexcept(FE_OVERFLOW) is not called?

Note: I'm not sure why this call is only needed on FreeBSD, but not on macOS, 
OpenBSD or NetBSD (operating systems close to FreeBSD).

--
components: Interpreter Core
messages: 347048
nosy: lemburg, mark.dickinson, stutzbach, vstinner
priority: normal
severity: normal
status: open
title: Should Py_Initialize() control the floating point mode?
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37363] Additional PEP578 hooks

2019-07-01 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +14337
pull_request: https://github.com/python/cpython/pull/14524

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36763] Implementation of the PEP 587

2019-07-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 36242fd871d0f0977e720d4fae5700774bd8c09a by Victor Stinner in 
branch 'master':
bpo-36763: Add PyConfig_SetWideStringList() (GH-1)
https://github.com/python/cpython/commit/36242fd871d0f0977e720d4fae5700774bd8c09a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36763] Implementation of the PEP 587

2019-07-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14336
pull_request: https://github.com/python/cpython/pull/14523

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37459] importlib docs improperly reference get_resource_loader()

2019-07-01 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37459] importlib docs improperly reference get_resource_loader()

2019-07-01 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

Good catch.  Are you going to submit a PR?

--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37469] Make it explicit that logging QueueHandler / QueueListener accepts a SimpleQueue.

2019-07-01 Thread Vinay Sajip


Change by Vinay Sajip :


--
keywords: +patch
pull_requests: +14335
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14521

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36168] DOC: Fix capitalization in string.rst

2019-07-01 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

Backport successfully completed. Marking this as fixed.

Congrats on your first patch, Krishna!

Thank you, everyone!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37472] Remove Lib/test/outstanding_bugs.py

2019-07-01 Thread STINNER Victor


STINNER Victor  added the comment:

I removed the file in the master branch. I don't think that it's worth it to 
remove it from other branches, so I just close the issue.


FYI I found this file while working on PR 14518:

commit 8f4ef3b019ce380022018587571b0f970e668de3 (upstream/master, master)
Author: Victor Stinner 
Date:   Mon Jul 1 18:28:25 2019 +0200

Remove unused imports in tests (GH-14518)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37472] Remove Lib/test/outstanding_bugs.py

2019-07-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e21b45a8e71d06a6a03f99261cab33e72b896bb9 by Victor Stinner in 
branch 'master':
bpo-37472: Remove Lib/test/outstanding_bugs.py (GH-14516)
https://github.com/python/cpython/commit/e21b45a8e71d06a6a03f99261cab33e72b896bb9


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   >