[issue42872] Inconsistent exception thrown by mkdir on different OSes

2021-01-09 Thread Hong Xu


New submission from Hong Xu :

Consider the following code:

-

import pathlib

def main():
pathlib.Path('tmp').touch()
pathlib.Path('tmp/tmp_sub').mkdir(parents=True)

main()



Run the code above in an empty directory.

On Linux, it throws a `NotADirectory` exception:

Traceback (most recent call last):
  File "", line 1, in 
  File "main.py", line 5, in main
pathlib.Path('tmp/tmp_sub').mkdir(parents=True)
  File "/usr/lib/python3.8/pathlib.py", line 1287, in mkdir
self._accessor.mkdir(self, mode)
NotADirectoryError: [Errno 20] Not a directory: 'tmp/tmp_sub'

-

On Windows, it throws a FileExistsError exception:

Traceback (most recent call last):
  File "C:\Users\hong\anaconda3\lib\pathlib.py", line 1284, in mkdir
self._accessor.mkdir(self, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 
'tmp\\tmp_sub'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 7, in 
main()
  File "main.py", line 5, in main
pathlib.Path('tmp/tmp_sub').mkdir(parents=True)
  File "C:\Users\hong\anaconda3\lib\pathlib.py", line 1288, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
  File "C:\Users\hong\anaconda3\lib\pathlib.py", line 1284, in mkdir
self._accessor.mkdir(self, mode)
FileExistsError: [WinError 183] Cannot create a file when that file already 
exists: 'tmp

--
components: Library (Lib), Windows
messages: 384715
nosy: Hong Xu, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Inconsistent exception thrown by mkdir on different OSes
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



[issue42872] Inconsistent exceptions thrown by mkdir on different OSes

2021-01-09 Thread Hong Xu


Change by Hong Xu :


--
title: Inconsistent exception thrown by mkdir on different OSes -> Inconsistent 
exceptions thrown by mkdir on different OSes

___
Python tracker 

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



[issue42872] Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes

2021-01-09 Thread Hong Xu


Change by Hong Xu :


--
title: Inconsistent exceptions thrown by mkdir on different OSes -> 
Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-09 Thread John McCabe


John McCabe  added the comment:

Thank you all for your time. I hope you don't feel it has been wasted since, at 
the very least, it confirms an issue in tkinter usage, albeit that the actual 
cause of the issue is TK itself.

--

___
Python tracker 

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



[issue24464] "sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3

2021-01-09 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset d16f6176abdecbb7ab231dc78beccfaa095beff6 by Erlend Egeberg 
Aasland in branch 'master':
bpo-24464: Fix sqlite3.enable_shared_cache() deprecation wrapper (GH-24170)
https://github.com/python/cpython/commit/d16f6176abdecbb7ab231dc78beccfaa095beff6


--

___
Python tracker 

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



[issue42873] Exponential time and space requirements for compilation of nested try/finally blocks

2021-01-09 Thread Mark Dickinson


New submission from Mark Dickinson :

tl;dr - contrived (but relatively short) code involving nested try/finally 
blocks can produce disproportionately large bytecode. I'm not expecting or 
suggesting any action here, but the situation seemed at least worth noting. 
Feel free to close this issue as a "well don't do that, then" (a.k.a. "wont 
fix")

Longer: Python 3.9 changed the way that bytecode was generated for try/finally 
(see #33387). For a "try" block body that can do any of raise, return or 
fall-off-the-end-of-the-block, the corresponding finally block gets three 
separate paths in the bytecode. If such trys are nested  times, we get 3^n 
separate paths in the bytecode.

Example code:


def f():
try:
if something(): return
finally:
try:
if something(): return
finally:
try:
if something(): return
finally:
try:
if something(): return
finally:
try:
if something(): return
finally:
do_cleanup()


import dis
dis.dis(f)


On my machine, running this and counting the do_cleanup invocations gives, as 
expected, a result of 243 = 3**5

% python3.9 nested_finally.py | grep do_cleanup | wc -l 
 243

That's fairly benign, but if I scale up to 10 nested blocks, the dis.dis call 
takes over 10 minutes to complete (the compilation itself still only takes a 
fraction of a second). The bytecode object is correspondingly large:

>>> len(f.__code__.co_code)
1741356

With 15 levels of nesting, compilation takes several seconds, and
the generated code is (again as expected) a couple of orders of magnitude 
larger:

>>> len(f.__code__.co_code)
533859040

I didn't try pushing this further than 15 levels of nesting.

As I said above, it's not clear to me whether this is actually an issue that 
needs to be addressed in practice. It seems unlikely that "real code" :TM: 
would run into this, but the effect seemed worth noting.

--
components: Interpreter Core
messages: 384718
nosy: Mark.Shannon, mark.dickinson
priority: normal
severity: normal
status: open
title: Exponential time and space requirements for compilation of nested 
try/finally blocks
type: performance
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-09 Thread Steve Dower


Steve Dower  added the comment:

That's the same patch that I'd write, and I agree, we should hook this.

If the fields are documented anywhere, we should add the audit event data to 
get them into the table in the docs. Otherwise, that patch looks good to me.

--

___
Python tracker 

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



[issue42874] configure errors

2021-01-09 Thread Martin Wheatley


New submission from Martin Wheatley :

I'm installin Python 3.91. on a Solaris 10 system (I known it's 'old' but I 
have a legacy installation to support).

Running ./configure the following errors are seen...

checking PROFILE_TASK... -m test --pgo
checking for --with-lto... no
checking for llvm-profdata... no
grep: illegal option -- q
Usage: grep -hblcnsviw pattern file . . .
checking for -Wextra... yes
checking whether /usr/sfw/bin/gcc accepts and needs -fno-strict-aliasing... yes
checking if we can turn off /usr/sfw/bin/gcc unused result warning... no
checking if we can turn off /usr/sfw/bin/gcc unused parameter warning... yes


and


checking aligned memory access is required... yes
checking for --with-hash-algorithm... default
checking for --with-tzpath... grep: illegal option -- q
grep: illegal option -- E
Usage: grep -hblcnsviw pattern file . . .
"/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo"
checking for --with-address-sanitizer... no
checking for --with-memory-sanitizer... no
checking for --with-undefined-behavior-sanitizer... no
checking for t_open in -lnsl... yes
checking for socket in -lsocket... yes

--
components: Installation
messages: 384720
nosy: martin.wheatley.home
priority: normal
severity: normal
status: open
title: configure errors
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



[issue42873] Exponential time and space requirements for compilation of nested try/finally blocks

2021-01-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

For extra fun, you can add `break` and `continue` paths into the mix to get a 
5-fold instead of 3-fold  code size increase per level of nesting. It's still 
contrived code, though.

Example where do_cleanup() ends up with 5**4 = 625 paths:



def f():
while True:
try:
if something(): break
elif something_else(): continue
elif yet_something_else(): return
finally:
try:
if something(): break
elif something_else(): continue
elif yet_something_else(): return
finally:
try:
if something(): break
elif something_else(): continue
elif yet_something_else(): return
finally:
try:
if something(): break
elif something_else(): continue
elif yet_something_else(): return
finally:
do_cleanup()


--

___
Python tracker 

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



[issue42873] Exponential time and space requirements for compilation of nested try/finally blocks

2021-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And there may be more than one return/break/continue statement in the try 
block. It increases the base of the degree.

At least for "return" we perhaps can merge different cases. But it would 
complicate the compiler and cannot help in other cases.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42872] Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes

2021-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, some operations can raise instances of different OSError subclasses on 
different platforms, because the corresponding C function sets different errno. 
It is so, and we cannot do anything with this. It is just a part of the 
difference between plaforms.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42873] Exponential time and space requirements for compilation of nested try/finally blocks

2021-01-09 Thread Mark Shannon


Mark Shannon  added the comment:

I don't see what the problem is here.
People just don't write code like that, at least not if they do code review ;)

And even, in the *extremely* rare case that they do, the code executes 
correctly and reasonably quickly. It just uses a bit of extra memory.

--

___
Python tracker 

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



[issue42873] Exponential time and space requirements for compilation of nested try/finally blocks

2021-01-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

> And there may be more than one return/break/continue statement in the try 
> block. It increases the base of the degree.

Ah, interesting. My understanding was that that can't happen, but I'll double 
check. In the control flow, all 'return' statements that leave a try block are 
going to the same place, so only one 'finally' branch needs to be generated no 
matter how many returns you have. And similarly for 'break' and 'continue'. 
IOW, what matters is the possible paths that can be taken when the finally 
block exits, and there are only up to 5 of those (for raise, return, break, 
continue, and leaving normally).

--

___
Python tracker 

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



[issue42873] Exponential time and space requirements for compilation of nested try/finally blocks

2021-01-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I don't see what the problem is here. People just don't write code like that.

Yes, agreed; as I said in the original post, I'm not expecting any action, but 
the effect did seem interesting enough to be worth noting in an issue (if only 
so that it can be recorded as a known "feature" and the resolution can be 
recorded for the future).

I'll close as won't fix.

--
resolution:  -> wont fix
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



[issue42872] Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes

2021-01-09 Thread Eryk Sun


Eryk Sun  added the comment:

NT filesystems are specified to fail with STATUS_OBJECT_PATH_NOT_FOUND 
(0xC03A) if a parent component in a path either does not exist or is not a 
directory. In the Windows API, this translates to ERROR_PATH_NOT_FOUND (3), 
which in the C runtime translates to ENOENT (2), which in Python is raised as 
FileNotFoundError.

The design of Path.mkdir() assumes POSIX behavior, which splits the above two 
cases respectively into ENOENT and ENOTDIR. Thus it assumes that 
FileNotFoundError means a parent component does not exist. This eliminates the 
race condition of having to test whether the parent path exists. In Windows, 
it's not possible to differentiate the two cases by error code alone, so 
unfortunately Path.mkdir() tries to create the parent path when it contains a 
non-directory component, and thus a nested FileExistsError exception is raised.

The design of os.makedirs() instead checks whether the parent exists before 
trying to create it, and ignores FileExitsError if creating the parent tree 
fails due to a race condition. This design behaves a bit more consistently 
across platforms, but it still fails with a different exception on Windows vs 
POSIX, i.e. FileNotFoundError vs NotADirectoryError.

--
nosy: +eryksun

___
Python tracker 

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



[issue42115] Caching infrastructure for the evaluation loop: specialised opcodes

2021-01-09 Thread Johan Dahlin


Change by Johan Dahlin :


--
nosy: +Johan Dahlin

___
Python tracker 

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



[issue42875] argparse incorrectly shows help string on a new line in case of long command string

2021-01-09 Thread Pavel Ditenbir


New submission from Pavel Ditenbir :

Steps to reproduce.

Run the attached script:
$ python3 argparse-indent-sample.py --help

The output is:
usage: argparse-indent-sample.py [-h] CMD ...

optional arguments:
  -h, --help   show this help message and exit

service:
  CMD  command to use
addadd something
remove remove something
a-very-long-command
   command that does something

Expected output is:
usage: argparse-indent-sample.py [-h] CMD ...

optional arguments:
  -h, --help   show this help message and exit

service:
  CMDcommand to use
add  add something
remove   remove something
a-very-long-command  command that does something

--
components: Library (Lib)
files: argparse-indent-sample.py
messages: 384728
nosy: DiPaolo
priority: normal
severity: normal
status: open
title: argparse incorrectly shows help string on a new line in case of long 
command string
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49730/argparse-indent-sample.py

___
Python tracker 

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



[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2021-01-09 Thread CrouZ


CrouZ  added the comment:

The problem exists in Python 3.8 as well, with the difference that 
``os.path.isdir("D:\\System Volume Information\\")`` also returns False.

Tested with Python 3.8.2 and 3.8.7.

--
versions: +Python 3.8

___
Python tracker 

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



[issue4963] mimetypes.guess_extension result changes after mimetypes.init()

2021-01-09 Thread Philippe Ombredanne


Philippe Ombredanne  added the comment:

The changes introduced by this ticket in 
https://github.com/python/cpython/commit/9fc720e5e4f772598013ea48a3f0d22b2b6b04fa#r45794801
 are problematic.

I discovered this from having tests failing when testing on Python 3.7 and up

The bug is that calling mimetypes.init(files) will NOT use my files, but 
instead use both my files and knownfiles.
This was not the case before as knownfiles would be ignored as expected when I 
provide my of files list.

This is a breaking API change IMHO and  introduces a buggy unstability : even 
if I want to ignore knownfiles by providing my list of of files, knownfiles 
will always be added and this results in erratic and buggy behaviour as the 
content of "knownfiles" is completely random based on the OS version and else. 

The code I am using is here 
https://github.com/nexB/typecode/blob/ba07c04d23441d3469dc5de911376d408514ebd8/src/typecode/contenttype.py#L308

I think we should reopen to fix (or create a new ticket)

--
nosy: +pombredanne

___
Python tracker 

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



[issue4963] mimetypes.guess_extension result changes after mimetypes.init()

2021-01-09 Thread Philippe Ombredanne


Philippe Ombredanne  added the comment:

Actually this is problematic on multiples counts:
1. the behaviour changes and this is a regression
2. even if that new buggy behaviour was the one to use, it should not give 
preference to knownfiles ovr init-provided files, but at least take the 
provided files first and knownfiles second.

--

___
Python tracker 

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



[issue42861] ipaddress - add ability to get next closet network of any prefix size

2021-01-09 Thread Faisal Mahmood


Faisal Mahmood  added the comment:

Updated the title and method naming, I previously mentioned the "next subnet" 
and called the method "next_subnet", but technically this is wrong.  What this 
method should be doing is finding the next closest network of prefix size n.

So I guess the method definition should be:
`next_network(self, next_network=None)`

--
title: ipaddress - add ability to get next closet subnet of any prefix size -> 
ipaddress - add ability to get next closet network of any prefix size

___
Python tracker 

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



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-09 Thread Ammar Askar


Ammar Askar  added the comment:

`tb_frame` is documented under 
https://docs.python.org/3/reference/datamodel.html

> Special read-only attributes: tb_frame points to the execution frame of the 
> current level

`tb_code` can similarly be documented here and the note about the audit event 
can be added. Thanks for the patch Ryan, would you like to add the 
documentation change Steve suggested and create a pull request out of it and 
contribute it? (https://devguide.python.org/pullrequest/)

--

___
Python tracker 

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



[issue42850] Process hangs when calling urllib.request in a multiprocessing.Process with import of sounddevice package

2021-01-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

No, let's leave 3.7 alone -- it's in security-fixes-only mode.

--
resolution:  -> fixed
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



[issue42870] Document changed argparse output wrt optional arguments in What's new in Python 3.10

2021-01-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

Quickest way to get that done is to send in a PR that updates whatsnew.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue42875] argparse incorrectly shows help string on a new line in case of long command string

2021-01-09 Thread Pavel Ditenbir


Change by Pavel Ditenbir :


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

___
Python tracker 

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



[issue42876] '''"""''' != '""""'

2021-01-09 Thread Andreas Zeller


New submission from Andreas Zeller :

The following line of code fails in Python 3.6, which I find surprising.

>>> assert '''"""''' == ''  # Fails

Note that the following all pass as expected:

>>> assert """'''""" == "'''"  # Passes
>>> assert '''""''' == '""'  # Passes

--
components: Interpreter Core
messages: 384736
nosy: andreas-zeller
priority: normal
severity: normal
status: open
title: '''"""''' != ''
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



[issue42752] multiprocessing Queue leaks a file descriptor associated with the pipe writer (#33081 still a problem)

2021-01-09 Thread mattip


mattip  added the comment:

In the expert index https://devguide.python.org/experts/ it lists @davin, 
@pitrou as referrents for multiprocessing. Adding then to the Nosy list

--

___
Python tracker 

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



[issue42877] TracebackException saves more data than it needs

2021-01-09 Thread Irit Katriel


New submission from Irit Katriel :

TracebackException saves both __cause__ and __context__ even though format() 
ignores the __context__ if there is __cause__.

If we change the constructor to save only what format() needs, it will save 
space and simplify the code.

--
components: Library (Lib)
messages: 384738
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: TracebackException saves more data than it needs
type: performance
versions: Python 3.10

___
Python tracker 

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



[issue42877] TracebackException saves more data than it needs

2021-01-09 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue42877] TracebackException saves more data than it needs

2021-01-09 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue42876] '''"""''' != '""""'

2021-01-09 Thread Eryk Sun


Eryk Sun  added the comment:

> assert '''"""''' == ''  # Fails

The left-hand side is a triple-quote string literal [1][2] that contains 3 
double-quote characters. The right-hand side is a single-quote string literal 
that contains 4 double-quote characters. Use the interactive shell to check the 
values. For example:

>>> list('''"""''')
['"', '"', '"']

>>> list('')
['"', '"', '"', '"']

If you have difficulty understanding an aspect of the language syntax, please 
ask a question in an appropriate forum such as python-tutor, python-list, or 
Stack Overflow.

---

[1] 
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
[2] https://docs.python.org/3/tutorial/introduction.html#strings

--
nosy: +eryksun
resolution:  -> not a bug
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



[issue42861] ipaddress - add ability to get next closet network of any prefix size

2021-01-09 Thread Faisal Mahmood


Change by Faisal Mahmood :


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

___
Python tracker 

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



[issue42766] urllib.request.HTTPPasswordMgr uses commonprefix instead of commonpath

2021-01-09 Thread Yair Frid


Change by Yair Frid :


--
keywords: +patch
nosy: +Fongeme
nosy_count: 1.0 -> 2.0
pull_requests: +23007
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24181

___
Python tracker 

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



[issue42878] urllib.request.HTTPPasswordMgr.is_suburi does not care about order

2021-01-09 Thread Yair Frid


New submission from Yair Frid :

In docs, it mentions that the function returns true if the base is a 'suburi' 
of test, but in reality, if is_suburi(base, test) then is_suburi(test, base) 
which is wrong in most cases (other than where base ~= test, meaning they are 
the same location)
I am unsure which versions of python are affected, but i suspect most of them 
(although we probably shouldn't backport this fix?)

--
components: Library (Lib)
messages: 384741
nosy: Fongeme
priority: normal
pull_requests: 23009
severity: normal
status: open
title: urllib.request.HTTPPasswordMgr.is_suburi does not care about order

___
Python tracker 

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



[issue33065] IDLE debugger: failure stepping through module loading

2021-01-09 Thread Timothy Geiser


Timothy Geiser  added the comment:

This issue is still open, 8.5 months after identifying the underlying cause.
What needs done to get a fix for this merged? Manual testing, or adding test 
cases? Anything I can do to help? I have 3.9.1 successfully built on a 
Raspberry Pi that I can reproduce the issue on, as well as reproduce the fix 
Terry suggested in msg366981.

--

___
Python tracker 

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



[issue42879] SystemError from class 'int'

2021-01-09 Thread Jason Oliver


New submission from Jason Oliver :

This is my first bug report so I hope that this is correctly formatted. I am 
learning how to use pygame and encountered the following error:
SystemError:  returned a result with an error set

I googled the error message and came across the following answer on 
stackoverflow:
https://stackoverflow.com/a/53796516

This stated that the problem could exist within the implementation of python 
and that I should file a bug report here.

I am using the following software installed through pip/pip3:
Python 3.8.4
pygame 2.0.1
OS Edition: Windows 10 Pro
OS Version: 20H2
OS build: 19042.685

The bug can be reproduced deterministically.

--
files: Movement.py
messages: 384743
nosy: jollyoliver657
priority: normal
severity: normal
status: open
title: SystemError from class 'int'
versions: Python 3.8
Added file: https://bugs.python.org/file49731/Movement.py

___
Python tracker 

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



[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-09 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

> Regardless of whether PR 23611 is accepted, the test that it adds should be 
> added to Python master to guard against regressions. I can submit that as a 
> separate PR. Before I do that, do I need to create a new bpo ticket, or can I 
> just reference this one?

For that, please submit a PR to importlib_resources and it will get synced to 
CPython later.

--

___
Python tracker 

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



[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-09 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Can you tell me more about the use-case that exhibited this undesirable 
behavior? That is, what loader is it that supports `open_binary` but not 
`is_resource` and doesn't have a `__origin__`?

--

___
Python tracker 

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



[issue42872] Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes

2021-01-09 Thread Irit Katriel


Irit Katriel  added the comment:

See also issue41737.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue42850] Process hangs when calling urllib.request in a multiprocessing.Process with import of sounddevice package

2021-01-09 Thread Robin Scheibler


Robin Scheibler  added the comment:

Thank you very much for your help!

--

___
Python tracker 

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



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-09 Thread Ryan Hileman


Change by Ryan Hileman :


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

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-09 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

No problem.  While your failing example was 'too long', you *did* search and 
find the appropriate previous issue, with my inadequate response and incorrect 
resolution, even though closed.  I appreciate having my understanding fixed.

IDLE uses several entry boxes in dialogs.  I have partially replaced error 
message boxes with error messages in the dialog.  For example, Open Module 
(Alt-M at least on Windows) opens a dialog to open a module.  Enter a bad name 
and "Error: module not found" is printed in red below, leaving the cursor in 
the entry box so the user can correct it (or Cancel).  As is turn out, this 
avoids any possibility of running into this bug.  I might have run into it 
before I replaced most old dialog + error box uses, but I now know to watch out 
in those remaining.

--

___
Python tracker 

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



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-09 Thread Ryan Hileman


Ryan Hileman  added the comment:

PR submitted, waiting on CLA process.

I added documentation at the field sites, but the audit event table generation 
does not handle attributes or object.__getattr__ very well at all, so I'm not 
updating the audit table for now.

The `.. audit-event:: object.__getattr__ obj,name frame-objects` sphinx 
directive right now just inserts a canned string """Raises an :ref:`auditing 
event ` object.__getattr__ with arguments obj,name.""", which would 
need additional boilerplate to describe these attributes properly. It also only 
adds a footnote style link to the audit table under __getattr__, and even moves 
object.__getattribute__ from the first [1] link position to a later number 
which is IMO is more confusing than not even linking them.

I think to make attributes look good in the table we would need a special 
sphinx directive for audited object.__getattr__ attributes, for example by 
modifying the template generator to fit each attribute on its own line under  
object.__getattr__ in the table.

For now I did not use the audit-event sphinx directive and manually inserted 
strings like this near the original attribute description in the docs: 
"""Accessing ``f_code`` raises an :ref:`auditing event ` 
``object.__getattr__`` with arguments ``obj`` and ``"f_code"``."""

I think audit table improvements should be handled in a separate issue, and by 
someone more familiar with that part of the doc generator, as cleaning it up 
looks like maybe a bigger scope than the current contribution.

--

___
Python tracker 

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



[issue4963] mimetypes.guess_extension result changes after mimetypes.init()

2021-01-09 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Phillipe: I was the first to comment, but had no futher involvement with this 
issue until now.  Multiple people, including coredevs, considered the old 
behavior to be buggy and multiple people, including coredevs, contributed to 
the fix.  You are unlikely to prevail arguing that the change is totally a 
mistake and should be totally reverted.

> the behaviour changes and this is a regression

Code bug fixes are supposed to change behavior.  We know that the change will 
break code that depends on the buggy behavior.  That is why we include an 
updated change log with each release.

The intended change is *not* a regression in itself.  A regression in a bug fix 
is an unintended change to some other behavior.  I don't believe (but could be 
mistaken) that you have argued or shown this.

Assuming that you are not asking for complete reversion, I suggest that you 
open a new issue, referencing this one, but taking the current behavior as the 
given.  Propose a revised behavior and argue that it is even better.  If you 
want to argue that the current behavior is buggy (compared to the current docs) 
so that your proposed revision should be backported, make that a separate 
argument.

--

___
Python tracker 

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



[issue42872] Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes

2021-01-09 Thread Hong Xu


Hong Xu  added the comment:

Should we update the document at least? The document doesn't mention 
NotADirectoryError or its super classes at all.

--

___
Python tracker 

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



[issue33065] IDLE debugger: failure stepping through module loading

2021-01-09 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +23011
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/24183

___
Python tracker 

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



[issue33065] IDLE debugger: failure stepping through module loading

2021-01-09 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am reluctant to make changes without adding tests, and until I focused again 
on how to do so, because of your ping, I had no idea how to do so.

The added test results in the same error, "AttributeError: 'BinData' object has 
no attribute 'length'" without the patch and passes with it.

--
stage: patch review -> commit review
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue33065] IDLE debugger: failure stepping through module loading

2021-01-09 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 81f87bbf9f65702062021a78abd9b8f82c98a414 by Terry Jan Reedy in 
branch 'master':
bpo-33065: Fix problem debugging user classes with __repr__ method (GH-24183)
https://github.com/python/cpython/commit/81f87bbf9f65702062021a78abd9b8f82c98a414


--

___
Python tracker 

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



[issue33065] IDLE debugger: failure stepping through module loading

2021-01-09 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +23012
stage: commit review -> patch review
pull_request: https://github.com/python/cpython/pull/24184

___
Python tracker 

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



[issue33065] IDLE debugger: failure stepping through module loading

2021-01-09 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23013
pull_request: https://github.com/python/cpython/pull/24185

___
Python tracker 

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



[issue33065] IDLE debugger: failure stepping through module loading

2021-01-09 Thread miss-islington


miss-islington  added the comment:


New changeset 5ded7efa6a7a232dd4a41e6e65e4dae47146514b by Miss Islington (bot) 
in branch '3.8':
bpo-33065: Fix problem debugging user classes with __repr__ method (GH-24183)
https://github.com/python/cpython/commit/5ded7efa6a7a232dd4a41e6e65e4dae47146514b


--

___
Python tracker 

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



[issue33065] IDLE debugger: failure stepping through module loading

2021-01-09 Thread miss-islington


miss-islington  added the comment:


New changeset 799f8489d418b7f9207d333eac38214931bd7dcc by Miss Islington (bot) 
in branch '3.9':
bpo-33065: Fix problem debugging user classes with __repr__ method (GH-24183)
https://github.com/python/cpython/commit/799f8489d418b7f9207d333eac38214931bd7dcc


--

___
Python tracker 

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



[issue42880] ctypes: variadic function call still doesn't work on Apple Silicon

2021-01-09 Thread Ziqiao Kong


New submission from Ziqiao Kong :

Hello! Thanks for your contribution on porting python to native Apple Silicon. 
I have noticed that there is an issue https://bugs.python.org/issue41100 and 
corresponding Github PR https://github.com/python/cpython/pull/22855 stating 
that variadic functions ABI has been corrected. However, during our test, it 
still doesn't work on Apple Silicon with brew-installed python 3.9.1 and python 
3..10.0a4 built from sources. The details are as follows:

A x86_64 Mojave Macmini with python 3.8:
```
/tmp $ python3 --version
Python 3.8.6
/tmp $ uname -a
Darwin *** 18.7.0 Darwin Kernel Version 18.7.0: Mon Apr 27 20:09:39 PDT 2020; 
root:xnu-4903.278.35~1/RELEASE_X86_64 x86_64
/tmp $ cat main.c
#include 
#include 
#include 
void test(uint64_t end, ...){
  int a;
  va_list valist;
  va_start(valist, end);
  a = va_arg(valist, int);
  va_end(valist);
  printf("%d\n", a);
  return;
}
/tmp $ cc -shared -g main.c -o ./main.dylib
/tmp $ cat test_main.py
from ctypes import *

d = CDLL("./main.dylib")
d.test.restype = None
d.test(c_uint64(12), c_int(34))
/tmp $ python3 test_main.py
34
/tmp $
```

An M1 Macbook Pro with brew-installed python 3.9.1
```
kabeor@kamino /tmp % python3 --version
Python 3.9.1
kabeor@kamino /tmp % cat main.c
#include 
#include 
#include 
void test(uint64_t end, ...){
  int a;
  va_list valist;
  va_start(valist, end);
  a = va_arg(valist, int);
  va_end(valist);
  printf("%d\n", a);
  return;
}
kabeor@kamino /tmp % cc -shared -g main.c -o ./main.dylib
kabeor@kamino /tmp % cat test_main.py
from ctypes import *

d = CDLL("./main.dylib")
d.test.restype = None
d.test(c_uint64(12), c_int(34))
kabeor@kamino /tmp % python3 test_main.py
48144104
kabeor@kamino /tmp %
```

An M1 Macbook Pro with python 3.10.0a4 built from Github release tarball
```
kabeor@kamino cpython-3.10.0a4 % ./python.exe --version
Python 3.10.0a4
kabeor@kamino cpython-3.10.0a4 % cp /tmp/main.c ./
kabeor@kamino cpython-3.10.0a4 % cp /tmp/test_main.py ./
kabeor@kamino cpython-3.10.0a4 % ./python.exe --version
Python 3.10.0a4
kabeor@kamino cpython-3.10.0a4 % cat ./main.c
#include 
#include 
#include 
void test(uint64_t end, ...){
  int a;
  va_list valist;
  va_start(valist, end);
  a = va_arg(valist, int);
  va_end(valist);
  printf("%d\n", a);
  return;
}
kabeor@kamino cpython-3.10.0a4 % cc -shared -g main.c -o ./main.dylib
kabeor@kamino cpython-3.10.0a4 % cat test_main.py
from ctypes import *

d = CDLL("./main.dylib")
d.test.restype = None
d.test(c_uint64(12), c_int(34))
kabeor@kamino cpython-3.10.0a4 % ./python.exe test_main.py
3
kabeor@kamino cpython-3.10.0a4 %
```

Thanks in advance!

--
components: ctypes
messages: 384756
nosy: lawrence-danna-apple, lazymio
priority: normal
severity: normal
status: open
title: ctypes: variadic function call still doesn't work on Apple Silicon
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue33065] IDLE debugger: failure stepping through module loading

2021-01-09 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
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