[issue43908] array.array should remain immutable

2021-04-29 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

The types converted to heap types in 3.10 are different from 3.9 therefore just 
backporting wouldn't help. Should we now try to apply the flags on other types? 
If yes then I'd like to volunteer to apply the flags on the types converted in 
3.9.

--

___
Python tracker 

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



[issue43908] array.array should remain immutable

2021-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24399
pull_request: https://github.com/python/cpython/pull/25710

___
Python tracker 

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



[issue43908] array.array should remain immutable

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> BTW, slightly related, AFAICT:
> - 
> https://github.com/python/cpython/blob/e047239eafefe8b19725efffe7756443495cf78b/Objects/typeobject.c#L4620-L4668
> - bpo-24912

object_set_class() must be changed to check for Py_TPFLAGS_IMMUTABLETYPE flag, 
rather than Py_TPFLAGS_HEAPTYPE.

Erlend: Do you want to write such change?

--

___
Python tracker 

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



[issue43908] array.array should remain immutable

2021-04-29 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> Erlend: Do you want to write such change?

Sure, I'll have a go at it. Thanks.

--

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24400
pull_request: https://github.com/python/cpython/pull/25711

___
Python tracker 

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



[issue43908] array.array should remain immutable

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5bd0619533ed6587ce76402e9b0b118eb4d4dd09 by Victor Stinner in 
branch 'master':
bpo-43908: Document Static Types in the C API (GH-25710)
https://github.com/python/cpython/commit/5bd0619533ed6587ce76402e9b0b118eb4d4dd09


--

___
Python tracker 

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



[issue28254] Add C API for gc.enable, gc.disable, and gc.isenabled

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b1f413e6cf63a1c5704fcb47f2095ef5db8970bb by Victor Stinner in 
branch 'master':
bpo-28254: Cleanup test_subprocess.test_preexec_gc_module_failure() (GH-25709)
https://github.com/python/cpython/commit/b1f413e6cf63a1c5704fcb47f2095ef5db8970bb


--

___
Python tracker 

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



[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check

2021-04-29 Thread Erlend Egeberg Aasland

New submission from Erlend Egeberg Aasland :

Use Py_TPFLAGS_IMMUTABLETYPE iso. Py_TPFLAGS_HEAPTYPE in object_set_class().

See also:
- bpo-43908 (particularly msg392286)
- bpo-24912
- 
https://github.com/python/cpython/blob/e047239eafefe8b19725efffe7756443495cf78b/Objects/typeobject.c#L4620-L4668

--
messages: 392290
nosy: erlendaasland, gvanrossum, pitrou, vstinner
priority: normal
severity: normal
status: open
title: Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check

___
Python tracker 

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



[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check

2021-04-29 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

IMO, we can drop most (all?) of the huge comment before the check in 
object_set_class(). History is preserved in the git log. Contrary to 
Py_TPFLAGS_HEAPTYPE, using Py_TPFLAGS_IMMUTABLETYPE speaks for itself. We might 
reduce it to just refer to to bpo-43908 and bpo-24912.

Something a la this:
/* Historically, only static types were immutable.
 * Py_TPFLAGS_IMMUTABLETYPE was introduced in Python 3.10.
 * See bpo-43908 and bpo-24912. */

What do you think?

--

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24401
pull_request: https://github.com/python/cpython/pull/25712

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 645ed62fb4c09b7e23887fcca0767b0f2d7d3fd6 by Victor Stinner in 
branch 'master':
bpo-43774: Remove unused PYMALLOC_DEBUG macro (GH-25711)
https://github.com/python/cpython/commit/645ed62fb4c09b7e23887fcca0767b0f2d7d3fd6


--

___
Python tracker 

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



[issue43974] setup.py should set Py_BUILD_CORE_MODULE as defined macro

2021-04-29 Thread Christian Heimes


New submission from Christian Heimes :

CPython's setup.py contains lots of

  extra_compile_args = ['-DPy_BUILD_CORE_MODULE']

to mark modules as core module. Extra compiler args is the wrong option. It's 
also tedious and err-prone to define the macro in each and every Extension() 
class instance.

The compiler flag should be set automatically for all core extensions and it 
should use be set using the correct option define_macros.

--
assignee: christian.heimes
components: Build
messages: 392293
nosy: christian.heimes, pablogsal, vstinner
priority: normal
severity: normal
status: open
title: setup.py should set Py_BUILD_CORE_MODULE as defined macro
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue43974] setup.py should set Py_BUILD_CORE_MODULE as defined macro

2021-04-29 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue43975] Incorrect MIME type returned for .js files Windows 10.

2021-04-29 Thread Scott Means


New submission from Scott Means :

This isn't *technically* a bug in Python, but it really presents like one. I 
like to run the http.server for quick-and-dirty web development, but today 
Chrome refused to load any of my .js files because the server is returning a 
MIME type of 'text/plain'. I downloaded server.py and played with it for a 
while, and realized that mimetypes.guess_type() is returning 'text/plain' for 
.js files. So then I read further into the code and realized that mimetypes is 
harvesting MIME types from the Windows registry. And for some reason, at least 
on my machine, HKEY_CLASSES_ROOT\.js\Content Type was 'text/plain'. Changing it 
to 'application/javascript' fixed my issue, but I'm guessing that a lot of 
Python devs won't bother to dig this deep. I don't know what an appropriate fix 
would be, other than to probably trust the built-in MIME types over the ones 
harvested from Windows.

--
components: Library (Lib)
messages: 392294
nosy: smeans
priority: normal
severity: normal
status: open
title: Incorrect MIME type returned for .js files Windows 10.
type: behavior
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



[issue43974] setup.py should set Py_BUILD_CORE_MODULE as defined macro

2021-04-29 Thread Christian Heimes


Christian Heimes  added the comment:

Related to the change:

It looks like we can also cleanup Modules/Setup and remove 
-DPy_BUILD_CORE_BUILTIN and -DPy_BUILD_CORE_MODULE. Modules/makesetup adds 
$PY_BUILTIN_MODULE_CFLAGS in the compile step. The variable is defined as

PY_BUILTIN_MODULE_CFLAGS= $(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN

--
stage: patch review -> 

___
Python tracker 

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



[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check

2021-04-29 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue43795] Implement PEP 652 -- Maintaining the Stable ABI

2021-04-29 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset f6ee4dad589c0953283dacb577a2d808fda7aae9 by Petr Viktorin in 
branch 'master':
bpo-43795: Generate python3dll.c and doc data from manifest (PEP 652) (GH-25315)
https://github.com/python/cpython/commit/f6ee4dad589c0953283dacb577a2d808fda7aae9


--

___
Python tracker 

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



[issue43908] array.array should remain immutable

2021-04-29 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24404
pull_request: https://github.com/python/cpython/pull/25714

___
Python tracker 

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



[issue43916] Check that new heap types cannot be created uninitialised

2021-04-29 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Serhiy, would you mind reviewing the PR? bpo-43974 will clean up the changes 
introduced to setup.py.

--

___
Python tracker 

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



[issue37892] IDLE Shell: isolate user code input

2021-04-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 8ec2f0dc0cd096b7a851b1a41e458daa23bf1ffc by Terry Jan Reedy in 
branch 'master':
bpo-37892: Use space indents in IDLE Shell (GH-25678)
https://github.com/python/cpython/commit/8ec2f0dc0cd096b7a851b1a41e458daa23bf1ffc


--

___
Python tracker 

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



[issue43651] PEP 597: Fix EncodingWarning warnings in the Python stdlib

2021-04-29 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +24405
pull_request: https://github.com/python/cpython/pull/25715

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset abfd6388cdba376a72686df52a9a98b2d558271b by Victor Stinner in 
branch 'master':
bpo-43774: Enhance debug build documentation (GH-25712)
https://github.com/python/cpython/commit/abfd6388cdba376a72686df52a9a98b2d558271b


--

___
Python tracker 

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



[issue1227748] doc: subprocess: inheritance of std descriptors inconsistent

2021-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-29 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
nosy: +orsenthil
nosy_count: 5.0 -> 6.0
pull_requests: +24406
pull_request: https://github.com/python/cpython/pull/25716

___
Python tracker 

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



[issue43892] Make match patterns explicit in the AST

2021-04-29 Thread Nick Coghlan


Nick Coghlan  added the comment:

After the next docs build, the documentation for the explicit AST nodes should 
be available https://docs.python.org/dev/library/ast.html#pattern-matching

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



[issue43651] PEP 597: Fix EncodingWarning warnings in the Python stdlib

2021-04-29 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 53dd6c99b39d90935c00bc1558582e494641248e by Inada Naoki in branch 
'master':
bpo-43651: Fix test_logging (GH-25715)
https://github.com/python/cpython/commit/53dd6c99b39d90935c00bc1558582e494641248e


--

___
Python tracker 

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



[issue43795] Implement PEP 652 -- Maintaining the Stable ABI

2021-04-29 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
nosy: +orsenthil
nosy_count: 3.0 -> 4.0
pull_requests: +24407
pull_request: https://github.com/python/cpython/pull/25716

___
Python tracker 

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



[issue42739] Crash when try to disassemble bogus code object

2021-04-29 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset c76da79b37d2bcbe575cc927ba0a9b7a9ce465db by Mark Shannon in 
branch 'master':
bpo-42739: Don't use sentinels to mark end of line table. (GH-25657)
https://github.com/python/cpython/commit/c76da79b37d2bcbe575cc927ba0a9b7a9ce465db


--

___
Python tracker 

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



[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-29 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-29 Thread Mark Shannon


Mark Shannon  added the comment:

I'm going to set the line number for executing the `__exit__()` function as 
that of the `with` keyword.

This should give a sensible traceback, and not break coverage, as the with 
statement is already executed.
It will impact traces and profiles, which is why the __exit__ call was not 
given a line number before.

Anthony, Ned,
please let me know if you disagree.

--

___
Python tracker 

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



[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check

2021-04-29 Thread Shreyan Avigyan


Change by Shreyan Avigyan :


--
nosy: +shreyanavigyan

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-04-29 Thread Filipe Laíns

Change by Filipe Laíns :


--
pull_requests: +24409
pull_request: https://github.com/python/cpython/pull/25718

___
Python tracker 

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



[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-29 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +24410
pull_request: https://github.com/python/cpython/pull/25719

___
Python tracker 

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



[issue42739] Crash when try to disassemble bogus code object

2021-04-29 Thread Mark Shannon


Change by Mark Shannon :


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



[issue28254] Add C API for gc.enable, gc.disable, and gc.isenabled

2021-04-29 Thread Petr Viktorin


Change by Petr Viktorin :


--
nosy: +petr.viktorin
nosy_count: 5.0 -> 6.0
pull_requests: +24411
pull_request: https://github.com/python/cpython/pull/25720

___
Python tracker 

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



[issue43817] Add inspect.get_annotations()

2021-04-29 Thread Larry Hastings


Larry Hastings  added the comment:

Ie debated about this with myself (and with a friend!) over the last few days, 
and I've concluded that evaluating strings by default is too opinionated for 
the standard library.  I've changed both inspect.signature() and 
inspect.get_annotations() so eval_str is False by default (and removed the 
ONLY_IF_STRINGIZED logic entirely).  Both functions will still raise an 
exception if eval_str=True, but this will only happen if the user explicitly 
requests evaluating the strings.

I've already updated the PR.

--

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-04-29 Thread Mark Shannon


Mark Shannon  added the comment:

> BTW, what are the three POP_TOP op codes in a row popping?

When exceptions are pushed to the stack, they are pushed as a triple: (exc, 
type, traceback)
so when we pop them, we need three pops.

--

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-04-29 Thread Mark Shannon


Mark Shannon  added the comment:

Responding to Serhiy's suggestions:
1 Add another column:
   Adding another column makes for lots of repetition in larger try blocks, and 
pushes useful information further to the right.
2 Add pseudo-instructions
  I find those misleading, as they aren't really there, and probably won't even 
correspond to the original SETUP_XXX instructions.

--

___
Python tracker 

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



[issue32824] Docs: Using Python on a Macintosh has bad info per Apple site

2021-04-29 Thread Glenn Travis

Glenn Travis  added the comment:

Here is a copy of the Apple Python call as of April 29, 2021.  To my way of 
thinking it seems that Apple is saying that someday they will indeed eliminate 
all the included “scripting” software from macOS and they further imply that 
one should install an. Up-to-date version of one’s particular chosen software. 

Last login: Thu Apr 29 08:22:47 on console
% python

WARNING: Python 2.7 is not recommended. 
This version is included in macOS for compatibility with legacy software. 
Future versions of macOS will not include Python 2.7. 
Instead, it is recommended that you transition to using 'python3' from within 
Terminal.

Python 2.7.16 (default, Feb 28 2021, 12:34:25) 
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy 
on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
% exit
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

> On Apr 28, 2021, at 4:25 PM, Glenn Travis  wrote:
> 
> 
> Glenn Travis  added the comment:
> 
> I see that this remains alive. I do have a newer question. Apple continues to 
> say that they are going to drop all their included versions of python and I 
> believe ruby in some future version of macOS. I thought that this would 
> happen in Big Sur, but python versions 2.7.16 still remains with us, why, I 
> don’t know.
> 
>> On Apr 28, 2021, at 3:21 PM, Irit Katriel  wrote:
>> 
>> 
>> Change by Irit Katriel :
>> 
>> 
>> --
>> versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.6, 
>> Python 3.7, Python 3.8
>> 
>> ___
>> Python tracker 
>> 
>> ___
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue28254] Add C API for gc.enable, gc.disable, and gc.isenabled

2021-04-29 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 14fc2bdfab857718429029e53ceffca456178827 by Petr Viktorin in 
branch 'master':
bpo-28254: Add PyGC_ functions to the stable ABI manifest (GH-25720)
https://github.com/python/cpython/commit/14fc2bdfab857718429029e53ceffca456178827


--

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-04-29 Thread Mark Shannon


Mark Shannon  added the comment:

I've played around with a few formats, and what I've ended up with is this:

1. Use the >> marker for for exception targets, as well as normal branch 
targets.
2. Add a text version of the exception handler table at the end of the 
disassembly.

This has all the information, without too much visual clutter.

The function `f` above looks like this:
>>> dis.dis(f)
  2   0 NOP

  3   2 LOAD_CONST   1 (1)
  4 LOAD_CONST   2 (0)
  6 BINARY_TRUE_DIVIDE
  8 POP_TOP
 10 NOP
 12 LOAD_CONST   0 (None)
 14 RETURN_VALUE
>>   16 NOP
 18 PUSH_EXC_INFO

  4  20 POP_TOP
 22 POP_TOP
 24 POP_TOP

  5  26 NOP
 28 POP_EXCEPT
 30 LOAD_CONST   3 ('fail')
 32 RETURN_VALUE
>>   34 POP_EXCEPT_AND_RERAISE
ExceptionTable:
  2 to 8 -> 16 (depth 0)
  18 to 24 -> 34 (depth 3) lasti


The 'lasti' field indicates that the offset of the last instruction is pushed 
to the stack, which is needed for cleanup-then-reraise code.

--

___
Python tracker 

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



[issue37387] test_compileall fails randomly on Windows when tests are run in parallel

2021-04-29 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

I've experienced that when a module is imported in the interpreter that module 
file (.py, .pyc, .pyd) cannot be deleted, renamed, rewritten, etc.   When that 
session is closed only then the file can be deleted, renamed, rewritten, all 
that stuff. Running tests in parallel means running 2 or more tests at the same 
time right? Therefore may be when test_compileall tries to rewrite the .pyc it 
results in a error because the file may be open as a module in another test 
that is also being ran at the same time. This should also clarify why 
test_compileall fails randomly and not all the time.

--
nosy: +shreyanavigyan

___
Python tracker 

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



[issue43908] array.array should remain immutable

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

check_set_special_type_attr() must also be updated to check for 
Py_TPFLAGS_IMMUTABLETYPE flag.

--

___
Python tracker 

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
title: array.array should remain immutable -> array.array should remain 
immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

___
Python tracker 

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> Erlend: Do you want to write such change?

Erlend created bpo-43973 and PR 25714.

--

___
Python tracker 

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



[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> IMO, we can drop most (all?) of the huge comment before the check in 
> object_set_class().

I don't think so. I don't understand why it's allowed to override the __class__ 
attribute of ModuleType instances whereas it's a static type. IMO the long 
comment remains useful and something should be done later to make the condition 
more generic, rather than checking PyType_IsSubtype(newto, &PyModule_Type) 
specifically.

--

___
Python tracker 

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-04-29 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> check_set_special_type_attr() must also be updated to check for 
> Py_TPFLAGS_IMMUTABLETYPE flag.

Ok, lets just use this issue for the PR. I can fix it in an hour or so.

--

___
Python tracker 

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



[issue37387] test_compileall fails randomly on Windows when tests are run in parallel

2021-04-29 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

I don't think it's a bug at all. It's a feature of Python that's causing this. 
And since it's not a bug I don't think copying the files in temporary directory 
would help at all because Windows is not giving the error. Python is giving the 
error to Python itself!

--

___
Python tracker 

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403

In the past, I used _random.Random for manual tests to compare static type and 
heap types, check which one is mutable.

C type _random.Random is inherited by Python type random.Random which is 
mutable. Since _random.Random is not directly seen by developers, I don't think 
that it's worth it to make it immutable.

For the other types, I would not say that they are "built-in types" or that it 
would be really bad to modify them. I would say that for the other types, the 
"We are consenting adults" rule stands. You can hack a type for a very specific 
need, but in this case you are on your own.

For example, people love to hack AST. Maybe the fact that ast.AST became 
mutable in Python 3.9 will unlock some crazy hack?

--

___
Python tracker 

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



[issue43908] array.array and re types must be immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
title: array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag 
-> array.array and re types must be immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

___
Python tracker 

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



[issue42904] get_type_hints does not provide localns for classes

2021-04-29 Thread Larry Hastings


Larry Hastings  added the comment:

kj: I just added support for default locals to inspect.get_annotation(), and I 
basically copied-and-pasted your dict(vars(base)) approach.

Is this "surprising, but required" behavior due specifically to this being a 
backwards-incompatible change? inspect.get_annotations() will be a new function 
in Python 3.10, which means I have no existing users to worry about. Does that 
mean I don't have the problem you're solving by reversing the order of 
namespace lookup, and I can just pass globals and locals in like normal?

--

___
Python tracker 

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



[issue43908] array.array and re types must be immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

check_set_special_type_attr() is used to prevent setting the following 
attributes:

* __name__
* __qualname__
* __module__
* __bases__
* __doc__

Right now, I cannot set the attribues on array.array type:

$ ./python
Python 3.10.0a7+ (heads/debug_doc2-dirty:0623fdb60d, Apr 29 2021, 12:06:18)
>>> import array

>>> array.array.__name__ = 'newname'
TypeError: can't set attributes of built-in/extension type 'array.array'

>>> array.array.__qualname__ = 'newname'
TypeError: can't set attributes of built-in/extension type 'array.array'

>>> array.array.__module__ = 'new module'
TypeError: can't set attributes of built-in/extension type 'array.array'

>>> array.array.__bases__ = (int,)
TypeError: can't set attributes of built-in/extension type 'array.array'

>>> array.array.__doc__ = 'doc'
TypeError: can't set attributes of built-in/extension type 'array.array'

I guess that type_setattro() is used and it checks for Py_TPFLAGS_IMMUTABLETYPE 
flag early.

--

___
Python tracker 

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



[issue43922] Double dots in quopri transported emails

2021-04-29 Thread Julien Castiaux


Julien Castiaux  added the comment:

Hello David,

The third party smtp software that causes troubles have been identified ! We 
are still investigating how to fix the problem at its root, ultimately this 
"fix" would not even be necessary. I'll keep you informed, just don't review or 
close the PR yet.

Regards,

--

___
Python tracker 

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



[issue43899] separate builtin function

2021-04-29 Thread Ammar Askar


Ammar Askar  added the comment:

Note that the `more_itertools` package on pypi also has a partition method.

Shall we close this off given that a recipe is already present and this is 
available as part of a popular 3rd-party library?

--
nosy: +ammar2

___
Python tracker 

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



[issue42904] get_type_hints does not provide localns for classes

2021-04-29 Thread Ken Jin


Ken Jin  added the comment:

@larry
> Is this "surprising, but required" behavior due specifically to this being a 
> backwards-incompatible change?

Yes. That's the main factor. I've since learnt that there's sadly more to it 
though :( (see below).

> Does that mean I don't have the problem you're solving by reversing the order 
> of namespace lookup, and I can just pass globals and locals in like normal?

I think it depends on the ergonomics of the function you're trying to achieve. 
I admit I haven't been fully keeping up with the inspect.get_annotations issue 
(sorry!), but here's what I learnt from get_type_hints:

(Partly copied over from PR 25632)
Example:

from typing import TypeVar, Generic
T = TypeVar('T')

class A(Generic[T]):
__annotations__ = dict(
some_b='B'
)


class B(Generic[T]):
class A(Generic[T]):
pass
__annotations__ = dict(
my_inner_a1='B.A',
my_inner_a2=A,
my_outer_a='A'  # unless somebody calls get_type_hints with 
localns=B.__dict__
)

>>> get_type_hints(B)

Currently (globalns then localns):
{'my_inner_a1': , 'my_inner_a2': , 
'my_outer_a': }

Swapped (localns then globalns):
{'my_inner_a1': , 'my_inner_a2': , 
'my_outer_a': }

I realized that looking into globalns then localns is a necessary evil: doing 
the converse (looking into localns first then globalns) would mean there is no 
way to point to the shadowed global `A`: it would always point to the local 
`B.A`. Unless of course you pass in localns=module.__dict__ or 
localns=globals().

Ultimately I think it's a sacrifice of ergonomics either way; looking into 
localns then globalns will require passing in the module's __dict__ to refer to 
a global being shadowed, while the converse (globalns then localns) introduces 
surprising eval behavior. Both are kind of tacky, but globalns then localns is 
slightly less so IMO. If the user wants to specify the inner class, they can 
just annotate 'B.A', if they want the outer, it's 'A'. But the localns then 
globalns approach will always point to `B.A`, the only way to access the 
shadowed global `A` is to pass in the strange looking argument 
localns=module.__dict__.

Phew, my head's spinning with localns and globalns now. Thanks for reading! I 
think it's your call. I'm inexperienced with elegant function design :P.

--

___
Python tracker 

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



[issue43916] Check that new heap types cannot be created uninitialised

2021-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24412
pull_request: https://github.com/python/cpython/pull/25721

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-04-29 Thread Éric Araujo

Éric Araujo  added the comment:

PR 25718 was opened and linked to this ticket.  It changes sysconfig to load 
install schemes from a separate module, so it’s not strictly about removing 
distutils but adding a new system customization feature.  I think it needs its 
own bug and mailing-list discussion with interested parties to make sure the 
interface works for them.

--

___
Python tracker 

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



[issue37387] test_compileall fails randomly on Windows when tests are run in parallel

2021-04-29 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

@vstinner What do you think? I'm not sure if there's a solution to this.

--

___
Python tracker 

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



[issue43916] Check that new heap types cannot be created uninitialised

2021-04-29 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +24413
pull_request: https://github.com/python/cpython/pull/25722

___
Python tracker 

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



[issue43908] array.array and re types must be immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-04-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

That is as intended, right?

On Thu, Apr 29, 2021 at 07:59 STINNER Victor  wrote:

>
> STINNER Victor  added the comment:
>
> check_set_special_type_attr() is used to prevent setting the following
> attributes:
>
> * __name__
> * __qualname__
> * __module__
> * __bases__
> * __doc__
>
> Right now, I cannot set the attribues on array.array type:
>
> $ ./python
> Python 3.10.0a7+ (heads/debug_doc2-dirty:0623fdb60d, Apr 29 2021, 12:06:18)
> >>> import array
>
> >>> array.array.__name__ = 'newname'
> TypeError: can't set attributes of built-in/extension type 'array.array'
>
> >>> array.array.__qualname__ = 'newname'
> TypeError: can't set attributes of built-in/extension type 'array.array'
>
> >>> array.array.__module__ = 'new module'
> TypeError: can't set attributes of built-in/extension type 'array.array'
>
> >>> array.array.__bases__ = (int,)
> TypeError: can't set attributes of built-in/extension type 'array.array'
>
> >>> array.array.__doc__ = 'doc'
> TypeError: can't set attributes of built-in/extension type 'array.array'
>
> I guess that type_setattro() is used and it checks for
> Py_TPFLAGS_IMMUTABLETYPE flag early.
>
> --
>
> ___
> Python tracker 
> 
> ___
>
-- 
--Guido (mobile)

--

___
Python tracker 

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-04-29 Thread Guido van Rossum

Guido van Rossum  added the comment:

I don’t think we’re waiting for more crazy hacks.

On Thu, Apr 29, 2021 at 07:27 STINNER Victor  wrote:

>
> STINNER Victor  added the comment:
>
> >
> https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403
>
> In the past, I used _random.Random for manual tests to compare static type
> and heap types, check which one is mutable.
>
> C type _random.Random is inherited by Python type random.Random which is
> mutable. Since _random.Random is not directly seen by developers, I don't
> think that it's worth it to make it immutable.
>
> For the other types, I would not say that they are "built-in types" or
> that it would be really bad to modify them. I would say that for the other
> types, the "We are consenting adults" rule stands. You can hack a type for
> a very specific need, but in this case you are on your own.
>
> For example, people love to hack AST. Maybe the fact that ast.AST became
> mutable in Python 3.9 will unlock some crazy hack?
>
> --
>
> ___
> Python tracker 
> 
> ___
>
-- 
--Guido (mobile)

--
title: array.array and re types must be immutable: add Py_TPFLAGS_IMMUTABLETYPE 
flag -> array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

___
Python tracker 

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



[issue43976] Introduce mechanism to allow Python distributors to add custom site install schemes

2021-04-29 Thread Filipe Laíns

New submission from Filipe Laíns :

As part of the distutils migration we plan to add a mechanism to let Python 
distributors to add site install schemes.

Currently, Python distributors are patching distutils to add custom install 
schemes for their packages. I think most of the reasoning boils down to them 
wanting to stop Python installers, such as pip, to modify/interfere with their 
packages.

With the distutils deprecation, and it becoming a 3rd party module, Python 
distributors can no longer patch it. Because of this, we made distutils use the 
sysconfig module instead, which fixes the issue at the moment -- Python 
distributors can now patch sysconfig itself -- but is not a long term solution.
To prevent Python distributors from having to patch implementation details, and 
have things break unexpectedly, we aim to introduce a system that distributors 
can use for this purpose.

The idea is that they have a config file, which they can pass to configure, and 
in that config file they can specify some extra install schemes. These install 
schemes will get added in sysconfig, and will be loaded in the site module 
initialization.

In practice, it will look something like this:

config.py
```
EXTRA_SITE_INSTALL_SCHEMES = {
'posix_prefix': {
'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}',
'purelib': '{base}/lib/python{py_version_short}/vendor-packages',
'platlib': 
'{platbase}/{platlibdir}/python{py_version_short}/vendor-packages',
'include':
'{installed_base}/include/python{py_version_short}{abiflags}',
'platinclude':
'{installed_platbase}/include/python{py_version_short}{abiflags}',
'scripts': '{base}/bin',
'data': '{base}',
},
}
```

./configure --with-vendor-config=config.py

--
components: Library (Lib)
messages: 392326
nosy: FFY00, jaraco
priority: normal
pull_requests: 24414
severity: normal
status: open
title: Introduce mechanism to allow Python distributors to add custom site 
install schemes
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



[issue41282] Deprecate and remove distutils

2021-04-29 Thread Filipe Laíns

Filipe Laíns  added the comment:

That is reasonable. I have created bpo-43976.

--

___
Python tracker 

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



[issue43614] Search is not beginner friendly

2021-04-29 Thread Ammar Askar


Ammar Askar  added the comment:

Just a little update to this, now that issue34398 is fixed it is possible to 
make this more beginner friendly by making sure the right terms have glossary 
entries.

As an example, here is a search for "argument" on the latest docs:

https://docs.python.org/3.10/search.html?q=argument

It would be nice if kwargs/args could also point to that.

--
nosy: +ammar2

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-04-29 Thread Paul Moore


Paul Moore  added the comment:

I'd suggest also posting it on the Packaging discourse, to get feedback from 
other distro maintainers.

--

___
Python tracker 

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



[issue43977] Implement the latest semantics for PEP 634 for matching collections

2021-04-29 Thread Mark Shannon


New submission from Mark Shannon :

PEP 634 has been updated to allow a faster and more robust implementation of 
matching sequences and mappings: https://github.com/python/peps/pull/1937

It needs to be implemented.

--
assignee: Mark.Shannon
messages: 392330
nosy: Mark.Shannon
priority: high
severity: normal
status: open
title: Implement the latest semantics for PEP 634 for matching collections

___
Python tracker 

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



[issue43977] Implement the latest semantics for PEP 634 for matching collections

2021-04-29 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-04-29 Thread Filipe Laíns

Filipe Laíns  added the comment:

We have discussed this approach a little in a few bug trackers, but I opened 
https://discuss.python.org/t/mechanism-for-distributors-to-add-site-install-schemes-to-python-installations/8467.

--

___
Python tracker 

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



[issue43565] PyUnicode_KIND macro does not has specified return type

2021-04-29 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
nosy: +ammar2
nosy_count: 4.0 -> 5.0
pull_requests: +24416
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25724

___
Python tracker 

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



[issue43974] setup.py should set Py_BUILD_CORE_MODULE as defined macro

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

I would prefer to limit the usage of the internal C API in extension modules 
built as dynamic libraries. See bpo-4: "[C API] Convert a few stdlib 
extensions to the limited C API (PEP 384)".

Also, this issue is motived by PR 25653 which requires to use the internal C 
API in many C extensions. But I proposed a different approach, PR 25710, which 
prevents that.

--

___
Python tracker 

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



[issue43974] setup.py should set Py_BUILD_CORE_MODULE as defined macro

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> It looks like we can also cleanup Modules/Setup and remove 
> -DPy_BUILD_CORE_BUILTIN and -DPy_BUILD_CORE_MODULE. Modules/makesetup adds 
> $PY_BUILTIN_MODULE_CFLAGS in the compile step.

Oh, I didn't notice.

--

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-04-29 Thread Senthil Kumaran


Senthil Kumaran  added the comment:


New changeset 76cd81d60310d65d01f9d7b48a8985d8ab89c8b4 by Senthil Kumaran in 
branch 'master':
bpo-43882 - urllib.parse should sanitize urls containing ASCII newline and 
tabs. (GH-25595)
https://github.com/python/cpython/commit/76cd81d60310d65d01f9d7b48a8985d8ab89c8b4


--

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-04-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24418
pull_request: https://github.com/python/cpython/pull/25726

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-04-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24419
pull_request: https://github.com/python/cpython/pull/25727

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-04-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24420
pull_request: https://github.com/python/cpython/pull/25728

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-04-29 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +24417
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/25725

___
Python tracker 

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



[issue37387] test_compileall fails randomly on Windows when tests are run in parallel

2021-04-29 Thread Tim Peters


Tim Peters  added the comment:

@Sheyvan, whether it's possible to delete (rename, etc) an open file is a 
property not of Python, but of the operating system. Windows doesn't allow it; 
Linux (for example) does.

It's generally considered to be "a bug" in CPython's implementation whenever it 
contains code that _assumes_ such things are safe (which is, alas, very easy 
for a Linux programmer to do by accident).

So that test_compileall fails in this way is inarguably "a bug". Guido's larger 
point is harder to address, though. In theory, we control everything our test 
suite does, but little of what arbitrary users do.

--
nosy: +tim.peters

___
Python tracker 

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



[issue37387] test_compileall fails randomly on Windows when tests are run in parallel

2021-04-29 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

What should we do? Should we skip test_compileall if the test suite is run in 
parallel?

--

___
Python tracker 

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



[issue43977] Implement the latest semantics for PEP 634 for matching collections

2021-04-29 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue37387] test_compileall fails randomly on Windows when tests are run in parallel

2021-04-29 Thread Tim Peters


Tim Peters  added the comment:

A "good" solution would be one that runs the test in such a way that it doesn't 
fail only on Windows ;-)

There are presumably many ways that could be accomplished, including ugly ones. 
For example, if test_compileall is in the collection of tests to be run, and 
it's a parallel run, run it first by itself, before starting anything else in 
parallel.

No, I'm not suggesting we do that. Just trying to get across that there are 
_always_ ways to worm around the bug du jour.

I don't know enough about when and why CPython decides to replace .pyc files 
now to make another suggestion worth anyone else's time to evaluate. Victor 
already has something else in mind, though.

--

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-04-29 Thread Senthil Kumaran


Senthil Kumaran  added the comment:


New changeset 491fde0161d5e527eeff8586dd3972d7d3a631a7 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-43882 - urllib.parse should sanitize urls containing ASCII newline 
and tabs. (GH-25595) (GH-25725)
https://github.com/python/cpython/commit/491fde0161d5e527eeff8586dd3972d7d3a631a7


--

___
Python tracker 

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



[issue42589] doc: Wrong "from" keyword link in Exceptions doc

2021-04-29 Thread miss-islington


miss-islington  added the comment:


New changeset 2fd928c8c1328424130cb9c51fc02ad5f9a66328 by sblondon in branch 
'master':
bpo-42589: Change URL for 'from' link when used in a raised exception (GH-23872)
https://github.com/python/cpython/commit/2fd928c8c1328424130cb9c51fc02ad5f9a66328


--
nosy: +miss-islington

___
Python tracker 

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



[issue42589] doc: Wrong "from" keyword link in Exceptions doc

2021-04-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24421
pull_request: https://github.com/python/cpython/pull/25730

___
Python tracker 

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



[issue42589] doc: Wrong "from" keyword link in Exceptions doc

2021-04-29 Thread Mariatta


Mariatta  added the comment:

Thanks for the PR. There is conflict with applying it to the 3.8 branch. If you 
can get to it, it would be great. Thanks.

--
nosy: +Mariatta
stage: patch review -> backport needed

___
Python tracker 

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



[issue43978] Incorrect "versionadded" info in typing.NoReturn documentation

2021-04-29 Thread Mariatta


New submission from Mariatta :

We received a documentation bug report in docs mailing list.

https://mail.python.org/archives/list/d...@python.org/thread/BLANNZUPUEOJ4LJYSJNNFLK5I7NYE3GH/#

It looks like the doc currently says that, typing.NoReturn was added in both 
3.5.4 and 3.6.2

It appeared from this change, that it was originally added in 3.6.5 
(https://github.com/python/cpython/pull/7107/files)

However, during a refactoring effort, in 
https://github.com/python/cpython/commit/ab72fdeb82c3ab045b480cd4bb4f928c12653ecb,
 the 3.5.4 and 3.6.2 info were added, perhaps due to copy-pasting.

I think it should be changed into .. versionadded:: 3.6.5

However, I'm curious to know whether there are other parts in the doc, where 
this info is wrong. So perhaps there was other parts of the doc that was added 
in 3.5.4, but somehow we moved that to the typing.NoReturn section.

For now, I think we can just fix it by adding .. versionadded: 3.6.5

And maybe someone else can look into other parts of the doc to see if the 
version info are correct.

--
assignee: docs@python
components: Documentation
keywords: easy, newcomer friendly
messages: 392341
nosy: Mariatta, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: Incorrect "versionadded" info in typing.NoReturn documentation
versions: Python 3.10, Python 3.11, 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



[issue42589] doc: Wrong "from" keyword link in Exceptions doc

2021-04-29 Thread miss-islington


miss-islington  added the comment:


New changeset 3eaa6f9d185f2a2c66d98a77d3ea3f407bc96d0e by Miss Islington (bot) 
in branch '3.9':
bpo-42589: Change URL for 'from' link when used in a raised exception (GH-23872)
https://github.com/python/cpython/commit/3eaa6f9d185f2a2c66d98a77d3ea3f407bc96d0e


--

___
Python tracker 

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



[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-29 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 088a15c49d99ecb4c3bef93f8f40dd513c6cae3b by Mark Shannon in 
branch 'master':
bpo-43933: Show frame.f_lineno as None, rather than -1, if there is no line 
number. (GH-25717)
https://github.com/python/cpython/commit/088a15c49d99ecb4c3bef93f8f40dd513c6cae3b


--

___
Python tracker 

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



[issue37387] test_compileall fails randomly on Windows when tests are run in parallel

2021-04-29 Thread Eryk Sun


Eryk Sun  added the comment:

> I don't know enough about when and why CPython decides to 
> replace .pyc files 

It's straight-forward in the case of py_compile.compile():

>>> pyc = py_compile.compile('test.py')
>>> f = open(pyc)
>>> try: py_compile.compile('test.py')
... except OSError as e: print(e)
...
[WinError 5] Access is denied: 
'__pycache__\\test.cpython-310.pyc.1914201873840' -> 
'__pycache__\\test.cpython-310.pyc'

Rewriting the file uses `importlib._bootstrap_external._write_atomic()`, which 
writes the PYC to a temporary name and then tries to replace the existing file 
via os.replace(). 

Replacing an existing filename will fail with access denied in Windows if the 
target filename exists and is already open, mapped as image/data, readonly, or 
a directory. Notably it's not a sharing violation in the case of an open file, 
which means it doesn't matter whether the open(s) share delete access or not. 
In Windows 10 the NT API has a new file rename operation that supports a flag 
to replace an open file, but in this case we're still stuck with the problem 
that existing opens have to share delete access. Most opens could share delete 
access without a problem, but most don't.

--
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.10, Python 3.11

___
Python tracker 

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



[issue43979] Simplify urllib.parse_qsl

2021-04-29 Thread Christoph Zwerschke


New submission from Christoph Zwerschke :

Just noticed the following code in urrlib.parse_qsl:

pairs = [s1 for s1 in qs.split(separator)]
for name_value in pairs:
...

see 
https://github.com/python/cpython/blob/088a15c49d99ecb4c3bef93f8f40dd513c6cae3b/Lib/urllib/parse.py#L755

This looks like an unnecessary list comprehension to me, probably a relic of 
earlier code that used a nested list comprehension for splitting with two 
different separators.

Can't we just do this instead now, which is faster and shorter?

   for name_value qs.split(separator):

I can provide a PR if wanted.

--
components: Library (Lib)
messages: 392345
nosy: cito
priority: normal
severity: normal
status: open
title: Simplify urllib.parse_qsl
type: performance
versions: Python 3.10, Python 3.11, 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



[issue37387] test_compileall fails randomly on Windows when tests are run in parallel

2021-04-29 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

What is the name of the new function introduced in Windows 10 NT API? Should we 
use it if the version is detected as Windows 10 (through a callback to a 
platform function or through GetVersion API)?

--

___
Python tracker 

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



[issue43969] "bad magic number" when Python 2's pyc file exists without py file

2021-04-29 Thread Mitchell Hentges


Mitchell Hentges  added the comment:

Looking closer into this, it appears that Python 3 will still try to load 
non-__pycache__ `.pyc` files. Perhaps I'm missing context, but aren't those 
only supposed by to written and read by Python 2?

Location where `pyc` loader is registered: 
https://github.com/python/cpython/blob/v3.9.4/Lib/importlib/_bootstrap_external.py#L1571-L1572
Location where `__pycache__` loading happens is part of SourceFileLoader here: 
https://github.com/python/cpython/blob/v3.9.4/Lib/importlib/_bootstrap_external.py#L870

I'll attach a patch to remove this pyc-loading for convenience, but I don't 
have enough context to be confident that it's the correct solution.

--
keywords: +patch
message_count: 1.0 -> 2.0
pull_requests: +24422
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25731

___
Python tracker 

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



[issue43980] netrc module looks for .netrc even on Windows where the convention is _netrc

2021-04-29 Thread Jerry Heiselman


New submission from Jerry Heiselman :

The netrc library defaults to looking for the .netrc file in the user's home 
directory. On Windows, this file is conventionally named _netrc. While one 
could pass the correct path to the library, the conventionally correct path 
should be used on all supported platforms.

--
components: Library (Lib)
messages: 392348
nosy: jheiselman
priority: normal
severity: normal
status: open
title: netrc module looks for .netrc even on Windows where the convention is 
_netrc
type: behavior
versions: Python 3.10, Python 3.11, 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



[issue43980] netrc module looks for .netrc even on Windows where the convention is _netrc

2021-04-29 Thread Jerry Heiselman


Jerry Heiselman  added the comment:

Created a simple PR to correct this.

--
keywords: +patch
message_count: 1.0 -> 2.0
pull_requests: +24423
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25732

___
Python tracker 

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



[issue43976] Introduce mechanism to allow Python distributors to add custom site install schemes

2021-04-29 Thread Steve Dower


Steve Dower  added the comment:

Any reason this couldn't be in sitecustomize.py? Either by poking values into 
sysconfig directly (for back-compat) or we train sysconfig to look inside 
sitecustomize for a well-known name.

--
nosy: +steve.dower

___
Python tracker 

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



[issue42904] get_type_hints does not provide localns for classes

2021-04-29 Thread Larry Hastings


Larry Hastings  added the comment:

Thank you for your in-depth and thoughtful reply!

I think that APIs should behave in a predictable way.  So, for my use case, I 
tell the user that I'm passing "globals" and "locals" into eval()--and I think 
I'd have to have a *very* compelling reason to swap them.  Since I don't have 
the backwards-compatibility problem you do, I think I should keep it simple and 
predictable and not swap them.

In reference to your example, I think it's natural enough that the A defined 
inside B eclipses the module-level A.  That's what the user would *expect* to 
happen.  If the user really wants to reference the module-level A, they have 
lots of options:

  * rename one or the other A to something else
  * establish an alias at module scope, and use that
  * explicitly say globals()['A']

So I'm not worried about it.

--

___
Python tracker 

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



[issue37387] test_compileall fails randomly on Windows when tests are run in parallel

2021-04-29 Thread Eryk Sun


Eryk Sun  added the comment:

> What is the name of the new function introduced in Windows 10 NT API? 
> Should we use it if the version is detected as Windows 10 (through a
> callback to a platform function or through GetVersion API)?

No, _bootstrap_external._write_atomic() or py_compile.compile() could implement 
the typical retry with exponential backoff to address a race condition. 
Otherwise I don't see what could be done currently in the main code. It would 
have to be addressed in the test code.

Regarding the new support for POSIX semantics, the base NT API isn't organized 
as a separate function for every operation or query, so it's not a new function 
name per se. Each kernel object type (e.g. File) has many information classes 
and a few query/set functions such as NtQueryInformationFile() and 
NtSetInformationFile(). Windows 10 added file information classes that support 
the ability to replace/unlink an open file, including FileLinkInformationEx 
(link), FileRenameInformationEx (relink), and FileDispositionInformationEx 
(unlink). WinAPI DeleteFileW() and RemoveDirectoryW() were updated to use the 
latter. I expect that CreateHardlinkW() and MoveFileExW() will be updated as 
well. It's only POSIX-'ish' semantics because the shared read-write-delete 
model is deeply ingrained in the NT file API. Opens have to opt in by sharing 
delete access, and most don't.

--

___
Python tracker 

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



[issue43981] test_idle is leaking references

2021-04-29 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

See for example:

https://buildbot.python.org/all/#/builders/511/builds/10/steps/4/logs/stdio

test_idle leaked [684, 684, 684] references, sum=2052
test_idle leaked [282, 282, 282] memory blocks, sum=846

--
assignee: terry.reedy
components: IDLE
messages: 392353
nosy: pablogsal, terry.reedy
priority: release blocker
severity: normal
status: open
title: test_idle is leaking references

___
Python tracker 

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



[issue43981] test_idle is leaking references

2021-04-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Marking this as a release blocker

--

___
Python tracker 

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



[issue43980] netrc module looks for .netrc even on Windows where the convention is _netrc

2021-04-29 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is a behaviour change not a simple bug fix. 3.6 through 3.9 are all in 
feature-freeze, and we're days away from the same for 3.10.

Not that I don't believe you about the _netrc convention on Windows, but do you 
have a link to a reliable source documenting that?

--
nosy: +steven.daprano
type: behavior -> enhancement
versions:  -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



[issue43980] netrc module looks for .netrc even on Windows where the convention is _netrc

2021-04-29 Thread Jerry Heiselman


Jerry Heiselman  added the comment:

The netrc file has no formal standard, but the following supports the claim of 
its conventional naming.

Excerpt from https://curl.se/docs/manpage.html#-n:
"Makes curl scan the .netrc (_netrc on Windows) file in the user's home 
directory for login name and password."

Excerpt from https://www.labkey.org/Documentation/wiki-page.view?name=netrc:
"On a Mac, UNIX, or Linux system the netrc file should be named .netrc (dot 
netrc) and on Windows it should be named _netrc (underscore netrc)."

And a 9+ year old stack overflow post indicating that the use of _netrc on 
Windows is quite well established and has been for some time. I know it's not 
authoritative, but it does establish the length of history for this.
https://stackoverflow.com/questions/6031214/git-how-to-use-netrc-file-on-windows-to-save-user-and-password

--

___
Python tracker 

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



  1   2   >