[issue41004] Hash collisions in IPv4Interface and IPv6Interface

2020-06-21 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

No @rvteja92, you don't need open multiple PRs, only make your changes on 
master branch. for more informations read this:
https://devguide.python.org/

And for the CLA sign it will take a while to be updated.

--

___
Python tracker 

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



[issue41004] Hash collisions in IPv4Interface and IPv6Interface

2020-06-21 Thread Ravi Teja P


Ravi Teja P  added the comment:

Hi
I have raised a PR for this. But my PLA is yet to be updated (I have singed it).

But add the fix to the existing versions (3.8, 3.9 and 3.10), do I need to 
raise PR for each of those branches?

--

___
Python tracker 

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



[issue41053] open() fails to read app exec links

2020-06-21 Thread Eryk Sun


Eryk Sun  added the comment:

Where the POSIX specification uses the term "symbolic link" [1], it means one 
and only one type of symlink, not multiple types of symlink with divergent 
behavior depending on the context. To be consistent, only one type of Windows 
reparse point [2] is classified as a POSIX symlink, the one that's designed to 
behave like a POSIX symlink in the kernel and API: IO_REPARSE_TAG_SYMLINK. 

It's particularly important that given os.path.islink is true, then os.readlink 
and os.symlink can create an equivalent copy. This is only implemented for 
IO_REPARSE_TAG_SYMLINK.

That said, Windows has a variety of filesystem link types, which it calls 
name-surrogate reparse points. Of this set, in most systems you're only likely 
to encounter IO_REPARSE_TAG_SYMLINK and IO_REPARSE_TAG_MOUNT_POINT. But 
Microsoft has a growing list of name-surrogate types, including: 
IO_REPARSE_TAG_IIS_CACHE, IO_REPARSE_TAG_GLOBAL_REPARSE (NPFS named-pipe 
symlink from server silo into host silo), IO_REPARSE_TAG_WCI_LINK and 
IO_REPARSE_TAG_WCI_TOMBSTONE (Windows container isolation), 
IO_REPARSE_TAG_PROJFS_TOMBSTONE (Projected filesystem tombstone, such as in VFS 
for Git), IO_REPARSE_TAG_LX_SYMLINK (WSL symlink created on a drvfs volume). In 
some cases these are used transparently behind the scenes (e.g. tombstones that 
mark deleted files), or there may be no handler for Windows callers (e.g. WSL 
symlinks are meaningless in Windows).

Note that the latter list does not include IO_REPARSE_TAG_APPEXECLINK. Even 
though "LINK" is in the name, this reparse point type is not any kind of 
filesystem link in practice since it is not handled by the I/O manager or a 
filter driver in the kernel. As discussed in my first message, all of the 
intended behavior of an app-exec link is implemented instead by user-mode API 
functions such as CreateProcessW. In that respect, an app-exec link is more 
like a shell link (i.e. a LNK file), which gets handled by ShellExecuteExW. I 
wouldn't expect the standard library to handle LNK files as symlinks.

---

The vast majority of registered reparse-point types are not link types (e.g. 
cloud files are dehydrated placeholder reparse points). The base Windows API 
has no special handling for the non-link cases. For example, MoveFileExW opens 
a non-link reparse point as a regular file. If it operated on the reparse point 
itself, like it does for a symbolic link, it would ignore the handler and 
potentially break something.

This is why we can't even rename an app-exec link, since there's no handler for 
the reparse tag:

>>> src = os.path.join(os.path.dirname(sys.executable), 'idle3.exe')
>>> dst = os.path.join(os.path.dirname(sys.executable), 'spam3.exe')
>>> try: os.rename(src, dst)
... except OSError as e: print('winerror:', e.winerror)
...
winerror: 1920

---

The standard library is not limited to just IO_REPARSE_TAG_SYMLINK links. It 
supports the broader category of Windows name-surrogate links in certain cases. 
For example, os.lstat doesn't follow them; os.readlink supports symlinks and 
mountpoints [*]; os.unlink operates on symlinks and mountpoints; and 
shutil.rmtree doesn't traverse mountpoints (unlike the POSIX implementation).

Caveat emptor regarding os.readlink, however. There are significant differences 
between symlinks and mountpoints. They're designed to behave like Unix symlinks 
and bind mountpoints, which have similar behavioral differences. Also, 
mountpoints are always evaluated on the server, so a remote mountpoint *must* 
be treated as opaque data [1]:

The following reparse tags, with the exception of
IO_REPARSE_TAG_SYMLINK, are processed on the server 
and are not processed by a client after transmission 
over the wire. Clients SHOULD treat associated 
reparse data as opaque data. 

---

[1] 
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap03.html#tag_21_03_00_75

[2] 
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/c8e77b37-3909-4fe6-a4ea-2b9d423b1ee4

--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-06-21 Thread miss-islington


miss-islington  added the comment:


New changeset 8ae5e8ec8147e6434454e66953c25848b848711a by Lysandros Nikolaou in 
branch '3.9':
[3.9] bpo-40939: Deprecate PyNode_Compile (GH-21036)
https://github.com/python/cpython/commit/8ae5e8ec8147e6434454e66953c25848b848711a


--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-06-21 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

Thanks Victor for the catch! I've opened a PR that deprecates PyNode_Compile in 
3.9.

--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-06-21 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 564cd187677ae8d1488c4d8ae649aea34ebbde07 by Lysandros Nikolaou in 
branch 'master':
bpo-40939: Rename PyPegen* functions to PyParser* (GH-21016)
https://github.com/python/cpython/commit/564cd187677ae8d1488c4d8ae649aea34ebbde07


--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-06-21 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
pull_requests: +20207
pull_request: https://github.com/python/cpython/pull/21036

___
Python tracker 

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



[issue39960] Using typename.__setattr__ in extension type with Py_TPFLAGS_HEAPTYPE is broken (hackcheck too eager?)

2020-06-21 Thread Guido van Rossum


Guido van Rossum  added the comment:

That sounds like the right thing to do. You should be able to recognize pure 
Python __setattr__ implementations by the presence of slot_tp_setattro in the 
tp_setattro slot. (Likewise for __delattr__.)

It's been really long since I looked at this -- do we still only support single 
inheritance at the C level? Because otherwise there would be another backdoor.

There's also tp_setattr (no 'o') but I think that's basically unused, and we 
ignored that in 2003 so we should be able to ignore it now. :-)

--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-06-21 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-40939: Remove the old parser (Part 2) (GH-21005)

This change removes PyNode_Compile() which is part of the public C API. Would 
you mind to also deprecate it, as you did for PyParser_xxx() functions?

--

___
Python tracker 

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



[issue41069] Use non-ascii file names in tests by default

2020-06-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue41069] Use non-ascii file names in tests by default

2020-06-21 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The following PR increases coverage of tests by making some paths non-ascii:

1. test.support.TESTFN now contains non-ascii characters if possible.
2. The temporary directory used as current working directory in tests also 
contains non-ascii characters if possible.

This helped to catch and fix one bug in zipfile and two bugs in handling 
PYTHONSTARTUP.

--
components: Tests
messages: 372022
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Use non-ascii file names in tests by default
type: enhancement
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



[issue38377] test_asyncio.test_events.GetEventLoopTestsMixin.test_get_event_loop_new_process mixin breaks in the Unix environment without working /dev/shm

2020-06-21 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, macOS buildbots are back to green, I close the issue.

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



[issue39960] Using typename.__setattr__ in extension type with Py_TPFLAGS_HEAPTYPE is broken (hackcheck too eager?)

2020-06-21 Thread Stefan Behnel


Stefan Behnel  added the comment:

This SO answer by Martijn Pieters explains the background:

https://stackoverflow.com/a/44854477

and links to the original python-dev discussion:

https://mail.python.org/pipermail/python-dev/2003-April/034535.html

The current implementation checks that the function being called is the one 
defined in the first non-heap type up the hierarchy. As long as heap types are 
only Python types, this is the first builtin/native/C-implemented (super)type. 
With extension types as heap types, however, it's no longer necessarily the 
type that defines the correct slot function.

IMHO, Greg Ewing gives the right direction here:

https://mail.python.org/pipermail/python-dev/2003-April/034569.html

> Providing some way for objects to prevent superclass
> methods from being called on them when they're not looking

So, I think we should do something like walking up the hierarchy to find the C 
function in it that is currently being called, and then check if it's the one 
we would expect or if a subclass defines a different one. The current check 
does not bother to search and just assumes that it knows which (super)type 
defines the right function to call.

--

___
Python tracker 

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



[issue41068] zipfile: read after write fails for non-ascii files

2020-06-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2020-06-21 Thread Stefan Behnel


Stefan Behnel  added the comment:

Feel free to use the patch in any way you like.

--

___
Python tracker 

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



[issue41068] zipfile: read after write fails for non-ascii files

2020-06-21 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

When open a ZIP archive, write a file with non-ascii name in it, and, not 
closing the archive, read that file back, it fails:

>>> import zipfile
>>> with zipfile.ZipFile('test.zip', 'w') as zf:
... zf.writestr('йцукен', '')
... zf.read('йцукен')
... 
Traceback (most recent call last):
  File "", line 3, in 
  File "/usr/lib/python3.8/zipfile.py", line 1440, in read
with self.open(name, "r", pwd) as fp:
  File "/usr/lib/python3.8/zipfile.py", line 1521, in open
raise BadZipFile(
zipfile.BadZipFile: File name in directory 'йцукен' and header 
b'\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd' differ.

--
components: Library (Lib)
messages: 372018
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: zipfile: read after write fails for non-ascii files
type: behavior
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue41058] pdb reads source files using the locale encoding

2020-06-21 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

The 3.7 PR is up to the release manager to decide on, it probably isn't worth 
merging there as this i not security related.  thanks for the fix Serhiy!

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue41058] pdb reads source files using the locale encoding

2020-06-21 Thread Gregory P. Smith


Change by Gregory P. Smith :


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

___
Python tracker 

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



[issue41058] pdb reads source files using the locale encoding

2020-06-21 Thread miss-islington


miss-islington  added the comment:


New changeset 26f6126b2aa116b5c613c104bde0bb5b791a0bfc by Miss Islington (bot) 
in branch '3.9':
bpo-41058: Use source file encoding in pdb.find_function(). (GH-21010)
https://github.com/python/cpython/commit/26f6126b2aa116b5c613c104bde0bb5b791a0bfc


--

___
Python tracker 

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



[issue41058] pdb reads source files using the locale encoding

2020-06-21 Thread miss-islington


miss-islington  added the comment:


New changeset 14195597b3a877209c20d00e0ec844234e624d13 by Miss Islington (bot) 
in branch '3.8':
bpo-41058: Use source file encoding in pdb.find_function(). (GH-21010)
https://github.com/python/cpython/commit/14195597b3a877209c20d00e0ec844234e624d13


--

___
Python tracker 

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



[issue41058] pdb reads source files using the locale encoding

2020-06-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20205
pull_request: https://github.com/python/cpython/pull/21034

___
Python tracker 

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



[issue41067] Haiku build fix - posix module

2020-06-21 Thread Gregory P. Smith


New submission from Gregory P. Smith :

This type of change might make more sense to integrate into configure.ac and 
pyconfig.h.in.  (does haiku use autoconf?)

But even if not, lets not scatter haiku ifdef HAIKU references all over the 
codebase.  Such ifdef's to redefine things should be lumped in a single 
maintainable spot in a given file, and if needed in multiple files they belong 
in a header.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Yes, I generally agree with your assessment. Let me know if you have any 
questions about the implementation as you're exploring a solution.

--

___
Python tracker 

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



[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread Jason R. Coombs


Change by Jason R. Coombs :


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



[issue41059] Large number of Coverity reports for parser.c

2020-06-21 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue41056] minor NULL pointer and sign issues reported by Coverity

2020-06-21 Thread miss-islington


miss-islington  added the comment:


New changeset fbf94af2af3c09493481b8559b84f6e9f0628c37 by Miss Islington (bot) 
in branch '3.9':
bpo-41056: Fix a NULL pointer dereference on MemoryError within the ssl module. 
(GH-21009)
https://github.com/python/cpython/commit/fbf94af2af3c09493481b8559b84f6e9f0628c37


--

___
Python tracker 

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



[issue41056] minor NULL pointer and sign issues reported by Coverity

2020-06-21 Thread miss-islington


miss-islington  added the comment:


New changeset 10bf6e482328f622f4b2659e4ad5e3d88f57ba58 by Miss Islington (bot) 
in branch '3.8':
bpo-41056: Fix a NULL pointer dereference on MemoryError within the ssl module. 
(GH-21009)
https://github.com/python/cpython/commit/10bf6e482328f622f4b2659e4ad5e3d88f57ba58


--

___
Python tracker 

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



[issue41004] Hash collisions in IPv4Interface and IPv6Interface

2020-06-21 Thread Ravi Teja P


Change by Ravi Teja P :


--
nosy: +rvteja92
nosy_count: 4.0 -> 5.0
pull_requests: +20204
pull_request: https://github.com/python/cpython/pull/21033

___
Python tracker 

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-06-21 Thread Ethan Furman


Ethan Furman  added the comment:

Not yet.  I want to investigate the idea Ankesh Saha had some more.

--
versions: +Python 3.10 -Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue41064] f-string SyntaxError gives offset within fake line, other issues

2020-06-21 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue39891] [difflib] Improve get_close_matches() to better match when casing of words are different

2020-06-21 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I fell like it's a bit weird to have a new function just for ignoring case, 
will a new function be required for every possible normalization like removing 
accents. One possible make the API handle those use cases would be to have a 
keyword-argument for this:


>>> difflib.get_close_matches('apple', ['APPLE'], normalization=str.lower)
['APPLE']

Then it could work with other normalization too without requiring a new 
function every time:

>>> difflib.get_close_matches('Remi', ['Rémi'], normalization=remove_a ccents)
['Rémi']

--
components: +Library (Lib)
nosy: +remi.lapeyre
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



[issue40814] Update typing module documentation based on PEP 585

2020-06-21 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't think we should deprecate List etc. (PEP 585 specifically punts on the 
topic) but it's good to start mentioning list[t] etc. in the docs. Do you want 
to volunteer to write some docs?

--

___
Python tracker 

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



[issue41067] Haiku build fix - posix module

2020-06-21 Thread David CARLIER


Change by David CARLIER :


--
components: Extension Modules
nosy: devnexen
priority: normal
pull_requests: 20203
severity: normal
status: open
title: Haiku build fix - posix module
type: compile error
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



[issue41064] f-string SyntaxError gives offset within fake line, other issues

2020-06-21 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +epaine

___
Python tracker 

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



[issue41064] f-string SyntaxError gives offset within fake line, other issues

2020-06-21 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

IDLE highlights the location of a SyntaxError according to its .lineno and 
.offset attributes.  For expressions within braces within f strings, the 
reported offset is respect to the expression augmented with surrounding ()s 
added, not the actual physical line.  From my perspective as IDLE maintainer, I 
consider this undocumented 'feature' a design bug.

Pablo, I know you did not do this, but you helped design and understand the new 
compiler.  If we cannot change .offset to report the real offset, can we add a 
new attribute, .line_offset for 3.9 and 3.10?  Does the new compiler know where 
within the line the expression starts?  Are there any other cases where .offset 
is not the real offset with respect to the actual code?  Or rather, are there 
other cases where the actual line is replaced with a constructed line?  Is so, 
are confusing fake ()s always added, that make the replacement *not* a 
substring of the original?  Are there any plans to add new cases like this?

In the absence of compile providing the line offset, every IDE that marks 
errors in the actual line has to separately code a workaround.  However, a 
change in 3.9 makes this harder.  In 3.8, errors within fstring expressions 
were tagged with .filename ''.  In 3.9, this is attribute is ''.


The REPL in 3.7 (very soon security fixes only) and 3.8:
>>> f'{*a}'
  File "", line 1
SyntaxError: can't use starred expression here
>>> f'{**a}'
  File "", line 1
(**a)
 ^
SyntaxError: invalid syntax
>>> f'{a a}'
  File "", line 1
(a a)
   ^
SyntaxError: invalid syntax


The REPL in 3.9/3.10 with the new parser is more consistent.
>>> f'{*a}'
  File "", line 1
(*a)  # Does not ^ belong under *?  See below.
   ^
SyntaxError: invalid syntax
>>> f"{'abc' + *a}"
  File "", line 1
('abc' + *a)  # This was the same in 3.8.
 ^
SyntaxError: invalid syntax

--
components: +IDLE
nosy: +pablogsal -epaine
title: Specialise syntax error of ** unpacking dict -> f-string SyntaxError 
gives offset within fake line, other issues
type: enhancement -> behavior
versions: +Python 3.8, Python 3.9

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2020-06-21 Thread Guido van Rossum


Guido van Rossum  added the comment:

Okay, I will add that diff (I'll probably add async def to the set of features 
tested). Do you mind if I just incorporate it in my diff? I could add an 
acknowledgment in the commit message. Otherwise you could send a separate PR.

--

___
Python tracker 

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



[issue41065] Use zip-strict in zoneinfo

2020-06-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread sorrow


sorrow  added the comment:

>When the class is created? 

I mean the class instance

--

___
Python tracker 

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



[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread sorrow


sorrow  added the comment:

>`Path` public AP.

API of course

--

___
Python tracker 

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



[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread sorrow


sorrow  added the comment:

>how common is this use-case

I don't know about that. I just know that I have to make my program work with 
these files. Asking the clients to stop using this (presumably incorrect) 
format (or the program that makes it) is not an option.

>It appears the file your client has sent and the minimal example you've 
>generated represents an invalid zip file.

Well, I didn't know that. But it doesn't change the matter for me.

>What I recommend is that you develop a subclass of zipfile.Path that supports 
>the abnormal format, use that for your work, and publish it (perhaps here, 
>perhaps as a library) for others with the same problem to use.

I guess I'll have to go this way.

>It opens up lots of questions, like:

I'll share my considerations about how I see it should be implemented.

>- should `at` include the leading slash?

I think it doesn't matter, because `at` property is not part of `Path` public 
AP. Ideally, the files with leading slashes and without them should be treated 
exactly the same (as if they didn't have the leading slash). So, the only thing 
I'm concerned with is `at` argument of `Path.__init__`. It shouldn't require 
leading slash in any case.

>- should the class support zip files with mixed leading and non-leading 
>slashes?

No, this is definitely an error and shouldn't work.

>- at what point does `Path` become aware of the format used?

When the class is created? 

>- are there emergent performance concerns?

For me - no, there aren't. I don't know how this kind of questions is resolved 
in python community though.

>Can we close this as invalid?

I guess you can.

--

___
Python tracker 

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-06-21 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి

Srinivas  Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) 
 added the comment:

We can close this?

--
nosy: +thatiparthy

___
Python tracker 

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



[issue41066] Update documentation for Pathlib

2020-06-21 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి

New submission from Srinivas  Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) 
:

The correspondence section between os, os.path vs pathlib is missing two 
entries.

https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module

1. os.link vs path.link_to
2. os.path.listdir vs path.iterdir

I think adding them would be a good addition.

--
assignee: docs@python
components: Documentation
messages: 372001
nosy: docs@python, thatiparthy
priority: normal
severity: normal
status: open
title: Update documentation for Pathlib
type: enhancement
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

>>It seems you may have discovered a use-case that violates that expectation, a 
>>case where `/a.txt` is identical to `a.txt`.

> The thing is: it's not.

I think maybe you misunderstood. I mean that the zipfile you have seems to be 
treating `/a.txt` as a file `a.txt` at the root of the zipfile, identical to 
another zipfile that has an item named `a.txt`.

I'm not saying that zipfile.Path handles that situation; your example clearly 
contradicts that notion.

> I provided minimal example where archive created with zipfile.ZipFile itself 
> reproduces this behaviour. Just prerpend all paths with / an it does not work.

Thank you. I'm grateful for the minimal example. What I'm trying to assess here 
is the impact - how common is this use-case and should it be supported. One 
option here might be to document the library as not supporting files whose 
names begin with a leading slash.

Digging into [the 
spec](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT), Section 
4.4.17.1 explicitly states:

> The path stored MUST NOT contain a drive or device letter, or a leading slash.

It appears the file your client has sent and the minimal example you've 
generated represents an invalid zip file.

In [this branch](https://github.com/jaraco/zipp/tree/bugfix/bpo-41035), I 
started exploring what it would take to support this format. Unfortunately, 
just patching the namelist was not enough. Supporting this change interacts 
with behaviors across a number of methods, so would add substantial complexity 
to the implementation. It becomes inelegant to manage the position in the file 
(`.at` property) when there's ambiguity about the underlying format. It opens 
up lots of questions, like:

- should `at` include the leading slash?
- should the class support zip files with mixed leading and non-leading slashes?
- at what point does `Path` become aware of the format used?
- are there emergent performance concerns?

In other words, the design relies heavily on the assumption that there's one 
way to store a file and two ways to store a directory (explicitly and 
implicitly).

Based on these findings, I'm disinclined to support the format in the canonical 
Path implementation.

What I recommend is that you develop a subclass of zipfile.Path that supports 
the abnormal format, use that for your work, and publish it (perhaps here, 
perhaps as a library) for others with the same problem to use. If enough people 
report it having usefulness, then I'd definitely consider incorporating it into 
the library, either as a separate implementation or perhaps integrating it 
(especially if that can be done without substantially complicating the 
canonical implementation).

Alternately, ask if the client can generate valid zip files. I'm eager to hear 
your thoughts in light of my work. Can we close this as invalid?

--

___
Python tracker 

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



[issue41064] Specialise syntax error of ** unpacking dict

2020-06-21 Thread E. Paine


E. Paine  added the comment:

This isn't an IDLE issue and is instead due to the core interpreter. This isn't 
a bug, there just isn't a more specialised error message for the dictionary 
unpacking failure.

Changing the error message to something more helpful would be an enhancement 
and therefore would not be back-ported to Python 3.9 and before.

--
components: +Interpreter Core -IDLE
nosy: +epaine
title: IDLE highlights wrong place when code has syntax error of ** unpacking 
dict in f-string -> Specialise syntax error of ** unpacking dict
type: behavior -> enhancement
versions: +Python 3.10 -Python 3.7, Python 3.8

___
Python tracker 

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



[issue41035] zipfile.Path does not work properly with zip archives where paths start with /

2020-06-21 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

I created [jaraco/zipp#56](https://github.com/jaraco/zipp/issues/56) to track 
the issue in the backport.

--

___
Python tracker 

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



[issue41065] Use zip-strict in zoneinfo

2020-06-21 Thread Ram Rachum


Change by Ram Rachum :


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

___
Python tracker 

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



[issue41065] Use zip-strict in zoneinfo

2020-06-21 Thread Ram Rachum


New submission from Ram Rachum :

Writing the PR now.

--
components: Library (Lib)
messages: 371997
nosy: brandtbucher, cool-RR
priority: normal
severity: normal
status: open
title: Use zip-strict in zoneinfo
type: enhancement
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



[issue41055] Remove outdated tests for tp_print

2020-06-21 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Nice.  I would have found the removed tests confusing.  I presume tp_print had 
something to do with print as a statement.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue41064] IDLE highlights wrong place when code has syntax error of ** unpacking dict in f-string

2020-06-21 Thread SilentGhost


Change by SilentGhost :


--
type: compile error -> behavior

___
Python tracker 

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



[issue1944] Document PyUnicode_* API

2020-06-21 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue41064] IDLE highlights wrong place when code has syntax error of ** unpacking dict in f-string

2020-06-21 Thread JNCressey


New submission from JNCressey :

Compare f"{*my_tuple}" with f"{**my_dict}".
Both are syntax errors since you can't use unpacking here, but the bug is as 
follows:

- For the tuple, IDLE highlights the asterisk and has the helpful message 
'SyntaxError: can't use starred expression here',

- But for the dictionary, the first few characters of your code are 
highlighted, regardless of where the syntax error is located, and the message 
only says 'SyntaxError: invalid syntax'.

Bug occurs in both 3.8.3 and 3.7.7, I haven't tested it in 3.6 nor 
in-development versions.

--
assignee: terry.reedy
components: IDLE
messages: 371995
nosy: JNCressey, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE highlights wrong place when code has syntax error of ** unpacking 
dict in f-string
type: compile error
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue41063] Avoid using the locale encoding for open() in tests

2020-06-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +Remove outdated tests for tp_print, pdb reads source files using 
the locale encoding, read_mime_types() should read the rule file using UTF-8, 
not the locale encoding

___
Python tracker 

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



[issue41063] Avoid using the locale encoding for open() in tests

2020-06-21 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Many tests use open() with the locale encoding for writing or reading files. 
They are passed because the written and read data a ASCII, and file paths are 
ASCII. But they do not test the case of non-ASCII data and file paths. In 
general, most of uses of the locale encoding should be changed.

1. In some cases it is enough to open the file in binary mode. For example when 
create an empty file, or use just fileno of the opened file.

2. In some cases the file should be opened in binary mode. For example, when 
compile the content of the file or parse it as XML, because the correct 
encoding is determined by the content (BOM, encoding coockie, XML declaration).

3. tokenize.open() or tokenize.detect_encoding() should be used when we read a 
Python source as a text.

4. os.fsdecode() and os.fsencode() may be used if the test file contains file 
paths and is read by bash or other external program.

5. encoding='ascii' should be specified if the test data always ASCII-only.

6. encoding='utf-8' should be specified if the test data can contain arbitrary 
Unicode characters.

7. Encoding different from 'ascii', 'latin1' and 'utf-8' should be used if 
arbitrary encodings should be supported.

8. Implicit locale encoding should be only used if the test is purposed to test 
the implicit encoding.

It is preferable to add non-ASCII characters in the test data.

I am working on a large patch for this (>50% is ready). Some parts of it may be 
extracted as separate PRs, and the rest will be exposed as a large PR. If 
changes are required not only in tests. separate issues will be opened.

--
components: Tests
messages: 371994
nosy: inada.naoki, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Avoid using the locale encoding for open() in tests
type: enhancement
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue41052] Opt out serialization/deserialization for heap type

2020-06-21 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 814b07bf814a804f60b897d18f1dbb5578b2c7fd by Dong-hee Na in branch 
'3.9':
[3.9] bpo-41052: Opt out serialization/deserialization for _random.Random 
(GH-21002). (GH-21030)
https://github.com/python/cpython/commit/814b07bf814a804f60b897d18f1dbb5578b2c7fd


--

___
Python tracker 

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



[issue41052] Opt out serialization/deserialization for heap type

2020-06-21 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +20201
pull_request: https://github.com/python/cpython/pull/21030

___
Python tracker 

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



[issue41052] Opt out serialization/deserialization for heap type

2020-06-21 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 6989af0bc7ea1e9a1acea16794e6f723d7b44110 by Dong-hee Na in branch 
'master':
bpo-41052: Opt out serialization/deserialization for _random.Random (GH-21002)
https://github.com/python/cpython/commit/6989af0bc7ea1e9a1acea16794e6f723d7b44110


--

___
Python tracker 

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



[issue39783] Optimize construction of Path from other Paths by just returning the same object?

2020-06-21 Thread Antony Lee


Change by Antony Lee :


--
nosy:  -Antony.Lee

___
Python tracker 

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



[issue41055] Remove outdated tests for tp_print

2020-06-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue41005] Permission denied: 'xdg-settings' when executing 'jupyter notebook' from command line

2020-06-21 Thread SBC King


SBC King  added the comment:

yeah I've updated the pr please review

--

___
Python tracker 

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



[issue41005] Permission denied: 'xdg-settings' when executing 'jupyter notebook' from command line

2020-06-21 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I've commented on the attached PR.

IMHO a correct fix is to catch and ignore PermissionError when calling 
xdg-settings (on all platforms). An xdg-settings executable that cannot be 
started due to permission problems is similar to that executable not being 
available at all.

--

___
Python tracker 

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



[issue41005] Permission denied: 'xdg-settings' when executing 'jupyter notebook' from command line

2020-06-21 Thread SilentGhost


Change by SilentGhost :


--
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue41062] Advanced Debugger Support C-API is useless without HEAD_LOCK()/HEAD_UNLOCK()

2020-06-21 Thread Andrei Pashkin


Andrei Pashkin  added the comment:

Here is what I mean by "Advanced Debugger Support" API:
https://docs.python.org/dev/c-api/init.html#advanced-debugger-support

--

___
Python tracker 

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



[issue41061] Incorrect expressions / assert with side effect in hashtable

2020-06-21 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue41062] Advanced Debugger Support C-API is useless without HEAD_LOCK()/HEAD_UNLOCK()

2020-06-21 Thread Andrei Pashkin


New submission from Andrei Pashkin :

To me it seems like Advanced Debugger Support C-API doesn't make sense without 
HEAD_LOCK() and HEAD_UNLOCK() which are private right now.

When researching how C-API works I've found this comment in the source code:
https://github.com/python/cpython/blob/e838a9324c1719bb917ca81ede8d766b5cb551f4/Python/pystate.c#L1176

It says that the lists of interpreter-state and thread-state objects (that Adv. 
Debugger Support API operates on) could be mutated even when GIL is held so 
there is need to acquire head mutex when accessing them. But there is no way to 
acquire head mutex using public C-API.

Am I right? If yes - it seems like HEAD_(UN)LOCK() should be made public.

--
components: C API
messages: 371988
nosy: pashkin
priority: normal
severity: normal
status: open
title: Advanced Debugger Support C-API is useless without 
HEAD_LOCK()/HEAD_UNLOCK()
type: behavior
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue41061] Incorrect expressions / assert with side effect in hashtable

2020-06-21 Thread Christian Heimes


New submission from Christian Heimes :

Coverity has found four issues in hashtable implementation and tests

Py_hashtable_get_entry_generic(_Py_hashtable_t *ht, const void *key)

CID 1464680 (#1 of 1): Evaluation order violation 
(EVALUATION_ORDER)write_write_typo: In entry = entry = (_Py_hashtable_entry_t 
*)((_Py_slist_t *)>buckets[index])->head, entry is written twice with the 
same value.


_Py_hashtable_get_entry_ptr(_Py_hashtable_t *ht, const void *key)

CID 1464602 (#1 of 1): Evaluation order violation 
(EVALUATION_ORDER)write_write_typo: In entry = entry = (_Py_hashtable_entry_t 
*)((_Py_slist_t *)>buckets[index])->head, entry is written twice with the 
same value.


test_hashtable(PyObject *self, PyObject *Py_UNUSED(args))

CID 1464668 (#1 of 1): Side effect in assertion 
(ASSERT_SIDE_EFFECT)assignment_where_comparison_intended: Assignment entry->key 
= (void *)(uintptr_t)key has a side effect. This code will work differently in 
a non-debug build.
CID 1464664 (#1 of 1): Side effect in assertion 
(ASSERT_SIDE_EFFECT)assignment_where_comparison_intended: Assignment 
entry->value = (void *)(uintptr_t)(1 + ((int)key - 97)) has a side effect. This 
code will work differently in a non-debug build.

--
assignee: christian.heimes
components: Interpreter Core
messages: 371987
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Incorrect expressions / assert with side effect in hashtable
type: compile error
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



[issue41005] Permission denied: 'xdg-settings' when executing 'jupyter notebook' from command line

2020-06-21 Thread SBC King


SBC King  added the comment:

yeah there is a bug as web browsers won't open when you launch them from python 
code please have a look at this issue posted on jupyternotebook github : 
https://github.com/jupyter/notebook/issues/3746 It was posted on the wrong 
place as it was not an issue with Jupiter but an issue with python.

--

___
Python tracker 

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



[issue41055] Remove outdated tests for tp_print

2020-06-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset f9bab74d5b34c64cf061e1629ff5f3092a4ca9b3 by Serhiy Storchaka in 
branch 'master':
bpo-41055: Remove outdated tests for the tp_print slot. (GH-21006)
https://github.com/python/cpython/commit/f9bab74d5b34c64cf061e1629ff5f3092a4ca9b3


--

___
Python tracker 

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



[issue41058] pdb reads source files using the locale encoding

2020-06-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20199
pull_request: https://github.com/python/cpython/pull/21027

___
Python tracker 

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



[issue41058] pdb reads source files using the locale encoding

2020-06-21 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 1.0 -> 2.0
pull_requests: +20198
pull_request: https://github.com/python/cpython/pull/21026

___
Python tracker 

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



[issue41058] pdb reads source files using the locale encoding

2020-06-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 19fcffa92773e008e4f5efb80047420a0cfafeec by Serhiy Storchaka in 
branch 'master':
bpo-41058: Use source file encoding in pdb.find_function(). (GH-21010)
https://github.com/python/cpython/commit/19fcffa92773e008e4f5efb80047420a0cfafeec


--

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2020-06-21 Thread Stefan Behnel


Stefan Behnel  added the comment:

PRs look good to me. Here is a test that fails for me with the master branch 
and works with your fixes. It has a slightly odd place in the subinterpreter 
tests, but I would argue that it's not entirely misplaced there. You would want 
to know when subinterpreters start rejecting valid code, wouldn't you? :)


diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 73e167a0b0..9bed8255e1 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -627,6 +627,24 @@ class SubinterpreterTest(unittest.TestCase):
 self.assertNotEqual(pickle.load(f), id(sys.modules))
 self.assertNotEqual(pickle.load(f), id(builtins))
 
+def test_subinterps_recent_language_features(self):
+r, w = os.pipe()
+code = """if 1:
+import pickle
+with open({:d}, "wb") as f:
+
+@(lambda x:x)  # Py 3.9
+def noop(x): return x
+
+a = (b := f'1{{2}}3') + noop('x')  # Py3.8 (:=) / 3.6 (f'')
+pickle.dump(dict(a=a, b=b), f)
+""".format(w)
+
+with open(r, "rb") as f:
+ret = support.run_in_subinterp(code)
+self.assertEqual(ret, 0)
+self.assertEqual(pickle.load(f), {'a': '123x', 'b': '123'})
+
 def test_mutate_exception(self):
 """
 Exceptions saved in global module state get shared between
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 808483ebd7..468e25ff9e 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -3468,6 +3468,8 @@ run_in_subinterp(PyObject *self, PyObject *args)
 const char *code;
 int r;
 PyThreadState *substate, *mainstate;
+/* only initialise 'cflags.cf_flags' to test backwards compatibility */
+PyCompilerFlags cflags = {0};
 
 if (!PyArg_ParseTuple(args, "s:run_in_subinterp",
   ))
@@ -3486,7 +3488,7 @@ run_in_subinterp(PyObject *self, PyObject *args)
 PyErr_SetString(PyExc_RuntimeError, "sub-interpreter creation failed");
 return NULL;
 }
-r = PyRun_SimpleString(code);
+r = PyRun_SimpleStringFlags(code, );
 Py_EndInterpreter(substate);
 
 PyThreadState_Swap(mainstate);

--

___
Python tracker 

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