[issue44669] TypeError: 'type' object is not subscriptable

2021-07-19 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

> While attempting to run an application

How are you starting this application? It looks like you're using Python 3.9 
standard library files (like _collections_abc.py in the traceback you posted), 
but is it possible that you're accidentally running an older version of the 
interpreter?

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue44598] test_constructor (test.test_ssl.ContextTests) ... Fatal Python error: Segmentation fault

2021-07-19 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి

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

ran on 3.9.6 branch with OpenSSL 1.1.1k  25 Mar 2021. I see this warning in the 
console. Please also see the attached log for full details.


/Users/srini/workspace/consulting/cpython/Lib/test/support/__init__.py:3105: 
ResourceWarning: unclosed 
  del self.thread
ResourceWarning: Enable tracemalloc to get the object allocation traceback

--
nosy: +thatiparthy
Added file: https://bugs.python.org/file50159/log

___
Python tracker 

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



[issue41546] pprint() gives exception when ran from pythonw

2021-07-19 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset aab1899c9d79083c1ff31d974ed8b562d3ca3b5d by Irit Katriel in 
branch 'main':
bpo-41546: make pprint (like print) not write to stdout when it is None 
(GH-26810)
https://github.com/python/cpython/commit/aab1899c9d79083c1ff31d974ed8b562d3ca3b5d


--

___
Python tracker 

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



[issue41546] pprint() gives exception when ran from pythonw

2021-07-19 Thread Irit Katriel


Change by Irit Katriel :


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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25783
pull_request: https://github.com/python/cpython/pull/27235

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-19 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset d09c13417890427f829e3df297beb0e27133f8f4 by Mark Shannon in 
branch 'main':
bpo-44645: Check for interrupts on any potentially backwards edge (GH-27216)
https://github.com/python/cpython/commit/d09c13417890427f829e3df297beb0e27133f8f4


--

___
Python tracker 

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



[issue44661] Update property_descr_set to use vectorcall if possible.

2021-07-19 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 635bfe8162981332b36cc556bac78e869af579c2 by Dong-hee Na in branch 
'main':
bpo-44661: Update property_descr_set to use vectorcall if possible. (GH-27206)
https://github.com/python/cpython/commit/635bfe8162981332b36cc556bac78e869af579c2


--

___
Python tracker 

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



[issue44661] Update property_descr_set to use vectorcall if possible.

2021-07-19 Thread Dong-hee Na


Dong-hee Na  added the comment:

class Person:
def __init__(self):
self.__age = 0

@property
def age(self):
return self.__age

@age.setter
def age(self, value):
self.__age = value

p = Person()
p.age = 10 # Now become faster

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



[issue44666] compileall.compile_file fails when sys.stdout is redirected to StringIO

2021-07-19 Thread Stefan Hölzl

Change by Stefan Hölzl :


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

___
Python tracker 

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



[issue44340] Add support for building cpython with clang thin lto

2021-07-19 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset b2cf2513f9184c850a69fab718532b4f7c6a003d by Dong-hee Na in branch 
'main':
bpo-44340: Add support for building with clang full/thin lto (GH-27231)
https://github.com/python/cpython/commit/b2cf2513f9184c850a69fab718532b4f7c6a003d


--

___
Python tracker 

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



[issue44340] Add support for building cpython with clang thin lto

2021-07-19 Thread Dong-hee Na


Dong-hee Na  added the comment:

Now CPython 3.11 supports the Thin LTO,
Thank you for the report and contribution, Brett!

And also thank you Pablo and Gregory for the reviews!

--

___
Python tracker 

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



[issue44340] Add support for building cpython with clang thin lto

2021-07-19 Thread Dong-hee Na


Change by Dong-hee Na :


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



[issue41972] bytes.find consistently hangs in a particular scenario

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:

I checked the original example in this issue and the newest change in GH-27091 
makes the `data.find(base)` case 8.2% faster compared to `main` while the 
`data.find(longer)` case is 10.8% faster.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset d01dceb88b2ca6def8a2284e4c90f89a4a27823f by Dennis Sweeney in 
branch 'main':
bpo-41972: Tweak fastsearch.h string search algorithms (GH-27091)
https://github.com/python/cpython/commit/d01dceb88b2ca6def8a2284e4c90f89a4a27823f


--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
keywords: +patch
nosy: +uriyyo
nosy_count: 5.0 -> 6.0
pull_requests: +25786
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27237

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-19 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 37bdd2221ce3607a81d5d7fafc4603d95ca3e8cb by Miss Islington (bot) 
in branch '3.10':
bpo-44645: Check for interrupts on any potentially backwards edge (GH-27216) 
(GH-27235)
https://github.com/python/cpython/commit/37bdd2221ce3607a81d5d7fafc4603d95ca3e8cb


--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread Lars


Lars  added the comment:

Happy to see progress on this issue and I can see that adding these attributes 
to the ABC's in typing makes the most sense. However for my direct use-case 
(simplified: using Any in a type checking descriptor) it would be really 
practical to have the __name__ (and perhaps __qualname__ and __module__) 
attributes in the Any type. This is mainly for consistent logging/printing 
purposes.

Since Any already has a _name attribute, changing this to __name__ might 
achieve this.

--

___
Python tracker 

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



[issue44672] Final "pass" is traced incorrectly in 3.9 (and before)

2021-07-19 Thread Ned Batchelder


New submission from Ned Batchelder :

A simple function with a last "pass" statement gets traced incorrectly, 
attributing the return to the pass instead of the actual last statement 
executed:

--- 8< --
import linecache, sys

def trace(frame, event, arg):
# The weird globals here is to avoid a NameError on shutdown...
if frame.f_code.co_filename == globals().get("__file__"):
lineno = frame.f_lineno
print("{} {}: {}".format(event[:4], lineno, linecache.getline(__file__, 
lineno).rstrip()))
return trace

def wrong_loop(x):
if x:
if x:
print(4)
else:
pass

print(sys.version)
sys.settrace(trace)

wrong_loop(8)
--

On 3.9 and before, this produces:

3.9.5 (default, May  5 2021, 06:50:43)
[Clang 12.0.0 (clang-1200.0.32.29)]
call 10: def wrong_loop(x):
line 11: if x:
line 12: if x:
line 13: print(4)
4
line 15: pass
retu 15: pass

Partly I'm writing this issue to record the problem, but partly to get a 
decision: will there be fixes made to 3.9 (or before) for issues like this?

--
components: Interpreter Core
messages: 397791
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: Final "pass" is traced incorrectly in 3.9 (and before)
type: behavior
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



[issue42238] Deprecate suspicious.py?

2021-07-19 Thread Julien Palard


Change by Julien Palard :


--
pull_requests: +25787
pull_request: https://github.com/python/cpython/pull/27238

___
Python tracker 

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



[issue42238] Deprecate suspicious.py?

2021-07-19 Thread Julien Palard


Julien Palard  added the comment:

Another one \o/

Fix in: https://github.com/python/cpython/pull/27238

It is:

:func:pdb.main

Detected by make suspicious as:

WARNING: [whatsnew/changelog:320] ":func" found in ": Refactor argument 
processing in :func:pdb.main to simplify"
WARNING: [whatsnew/changelog:320] ":pdb" found in ": Refactor argument 
processing in :func:pdb.main to simplify"

I added a test in the same PR to spot this one in rstlint.

--

___
Python tracker 

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



[issue17088] ElementTree incorrectly refuses to write attributes without namespaces when default_namespace is used

2021-07-19 Thread Daan Luttik


Daan Luttik  added the comment:

Is there any workaround for this? this bug still seems to be present in python 
3.9.6.

--
nosy: +dtluttik
versions: +Python 3.9 -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 
3.5

___
Python tracker 

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



[issue17088] ElementTree incorrectly refuses to write attributes without namespaces when default_namespace is used

2021-07-19 Thread Stefan Behnel


Stefan Behnel  added the comment:

The obvious work-around is to not use a default namespace. The result is just a 
visual difference, not a semantic one.

If someone wants to continue with the existing PR, I'll try to free some time 
to review any improvements.

--
versions: +Python 3.10, Python 3.11 -Python 3.9

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:

> I think __module__ should be set to ‘typing’, and __qualname__ to 
> ‘typing.WhatEver’.

PEP 3155 specifies that `__qualname__` does not include the module name:
https://www.python.org/dev/peps/pep-3155/#excluding-the-module-name

Rather, it's for nested classes and classes created in local scopes.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44624] Script name for venv PowerShell activate

2021-07-19 Thread Vinay Sajip


Vinay Sajip  added the comment:

In this case, there are two reasons IMO for not doing this:

1. Backward compatibility might be affected.
2. It may be more important to conform to venv conventions than Powershell 
conventions in this specific case.

I wasn't aware that PowerShell scripts out in the wild follow these namig 
conventions rigidly - that hasn't been my experience. Is it the case? Who 
polices that? Of course, in environments that mandate this level of 
conformance, you can easily subclass and override the relevant functionality to 
have the script be named exactly how you want.

--

___
Python tracker 

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



[issue44673] Embedded Python - local directories in pythonXX._pth

2021-07-19 Thread emve


New submission from emve :

When I add mylib to python39._pth, Python treats
it relatively to c:\Python3 (where my embedded python resides).

>>> import sys
>>> print('\n'.join(sys.path))
c:\python3\python39.zip
c:\python3
c:\python3\lib
c:\python3\mylib
c:\python3\lib\site-packages
>>>

However, my mylib directory is in my current project directory,
which is obviously not under c:\Python3

I know that the solution is to enter full path to mylib into python39._pth, but 
it is quite unconvenient as I have multiple projects, each with its own local 
modules in mylib directory.

Is there a way to simply add only one mylib
entry into python39._pth?

--
messages: 397797
nosy: emve
priority: normal
severity: normal
status: open
title: Embedded Python - local directories in pythonXX._pth
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



[issue44672] Final "pass" is traced incorrectly in 3.9 (and before)

2021-07-19 Thread Mark Shannon

Mark Shannon  added the comment:

I say no, for a couple of reasons.

1. PEP 626 only applies to 3.10 onwards
2. The bytecode optimizer in 3.9 doesn't understand line numbers.
Changing it would be a lot of effort and likely to introduce more bugs than it 
fixes.

Ultimately it is Łukasz's decision, though.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44674] dataclasses should allow frozendict default value

2021-07-19 Thread Gianni Mariani


New submission from Gianni Mariani :

Using a frozendict as a default value should not cause an error in dataclasses. 
The check for mutability is:

   isinstance(f.default, (list, dict, set))

It appears frozendict has been changed to have a dict base class and it now 
raises an exception.

There should be a way to indicate object mutability as the purpose of the 
isinstance(f.default, (list, dict, set)) check is for mutable default values.

Using default_factory to work around this issue is cumbersome.

--
components: Library (Lib)
messages: 397799
nosy: gianni
priority: normal
severity: normal
status: open
title: dataclasses should allow frozendict default value
type: compile error
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



[issue44674] dataclasses should allow frozendict default value

2021-07-19 Thread Eric V. Smith


Eric V. Smith  added the comment:

I agree that would be an improvement.

--
nosy: +eric.smith

___
Python tracker 

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



[issue44490] PEP 604 Union (int | str) doesn't have __parameters__

2021-07-19 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset a2721649598eb715304a1ac8678a409585f73b27 by Ken Jin in branch 
'3.10':
bpo-44490: Improve typing module compatibility with types.Union (GH-27048) 
(#27222)
https://github.com/python/cpython/commit/a2721649598eb715304a1ac8678a409585f73b27


--

___
Python tracker 

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



[issue42238] Deprecate suspicious.py?

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset fbf10080bb369cfef1f230c2cd5135a558b242d5 by Julien Palard in 
branch 'main':
bpo-42238: Fix small rst issue in NEWS.d/. (#27238)
https://github.com/python/cpython/commit/fbf10080bb369cfef1f230c2cd5135a558b242d5


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-19 Thread Ken Jin


Ken Jin  added the comment:

@Serhiy, this doesn't just affect typing.Union, it seems that the rest of the 
typing types don't substitute:

>>> (int | T)[typing.List[str]]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Each union arg must be a type, got typing.List[str]

We should probably loosen the check during the union_getitem substitution -- no 
need to raise the TypeError or check for is_union, just blindly replace the 
TypeVar. We already do this for types.GenericAlias:

>>> list[T][1]
list[1]

Or if you want to continue checking, maybe checking for PyCallable_Check(obj) 
in substitution is enough - typing internally accepts callable(o) too:

https://github.com/python/cpython/blob/3.10/Lib/typing.py#L146

--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread Ken Jin


Ken Jin  added the comment:

Yurii has a working PR for __name__ in _BaseGenericAlias, but not for 
_SpecialForm yet.

Guido and/or Lukasz, do y'all think we should support __name__ and __qualname__ 
for special forms too? Personally I don't see how it'd hurt and I'm +1 for this.

--

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:

Looks like this can be closed now, the original issue is fixed, the original 
patch is merged for 3.10, and the improved patch is merged for 3.11.

Thanks! ✨ 🍰 ✨

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



[issue43124] [security] smtplib multiple CRLF injection

2021-07-19 Thread R. David Murray


R. David Murray  added the comment:

My apologies, I did not think about the possibility of an English issue.  I was 
reacting to the "security report speak", which I find often makes a security 
issue sound worse than it is :)  Thank you for reporting this problem, and I do 
think we should fix it.

My posting was directed at the severity of the issue, since it was potentially 
holding up a release.  My point about the example is that without an example of 
code that could reasonably be expected to use user input in a call that could 
inject newlines, we can treat this as a low priority issue.  If we had a 
proposed example of such code, then the priority would be higher.  If it was an 
example of such code "in the wild", then it would be quite high :)

The reason I'm saying we should have an example in order to consider it higher 
priority is that I cannot see *any* likelihood that this would be a problem in 
practice.  Let me explain.

putcmd is an *internal* interface.  If we look at the commands that call putcmd 
or docmd, the only ones that pass extra data that aren't pretty obviously safe 
(ie: not clearly sanitized data) are rcpt and mail[*].  In both cases the item 
of concern is optionslist.  optionslist is a list of *SMTP server options*.  
This is not data that is reasonably taken from user input, it is data provided 
*by the programmer*.

[*] I did double check to make sure that email.utils.parseaddr sanitizes both 
\r and \r, just to be sure :)

Therefore this is *not* a significant security issue.  But as I said, we should 
take the "defense in depth" approach and apply the check in putcmd as you 
recommend.  I just don't think it needs to hold up a release.

--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

I see this as part of a trend to improve runtime introspection of complex
type expressions. That seems to be going ahead regardless of whether we
like it or not, so let's do this.

--

___
Python tracker 

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



[issue44610] Format issue with strftime and %Y

2021-07-19 Thread Bartosz Kaznowski


Bartosz Kaznowski  added the comment:

Ok, thanks @iritkatriel. I have closed it as a duplicate.

I did notice after posting this that in the cpython source code people work 
around this issue. Now I can see why.

I guess I will just have to work around this issue too. Luckily it doesn't 
cause too many problems for what I need.

Thanks!

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



[issue37224] [subinterpreters] test__xxsubinterpreters fails randomly

2021-07-19 Thread hai shi


hai shi  added the comment:

I use this add_printf_to_get_details_from_race_condition.patch to get some 
details of the running subinterpreter.

The successful output of test_already_running:
test_already_running (test.test__xxsubinterpreters.RunStringTests) ... In 
interp_create, the current state is: 0x23ee8f0
In interp_list_all, the current state is: 0x23ee8f0 # Entering _running().
Before interp runs, the current state is: 0x2489590 # Running the interp  in 
thread.
In interp_list_all, the current state is: 0x23ee8f0 # Running 
interpreters.list() in _running().
Before interp runs, the current state is: 0x23ee8f0 # Running the interp in 
test_already_running().
After interp runs, the current state is: 0x25cf0e0 # Running the interp in 
thread.
In interp_list_all, the current state is: 0x23ee8f0 # Clearing the created 
interps.

The failed output of test_already_running:
test_already_running (test.test__xxsubinterpreters.RunStringTests) ... In 
interp_create, the current state is: 0x23e58f0
In interp_list_all, the current state is: 0x23e58f0
In interp_list_all, the current state is: 0x23e58f0 # Compared to the 
successful output of test_already_running, the interp doesn't run in time. 
Before interp runs, the current state is: 0x23e58f0
spam
After interp runs, the current state is: 0x24fdfc0
In interp_list_all, the current state is: 0x23e58f0
FAIL

==
FAIL: test_already_running (test.test__xxsubinterpreters.RunStringTests)
--
Traceback (most recent call last):
  File "/home/shihai/cpython/Lib/test/test__xxsubinterpreters.py", line 835, in 
test_already_running
with self.assertRaises(RuntimeError):
AssertionError: RuntimeError not raised

--

Ran 123 tests in 71.968s

FAILED (failures=1, skipped=6)
Warning -- Uncaught thread exception: RuntimeError
Exception in thread Thread-8 (run):
Traceback (most recent call last):
  File "/home/shihai/cpython/Lib/threading.py", line 1009, in _bootstrap_inner
self.run()
^^
  File "/home/shihai/cpython/Lib/threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
^
  File "/home/shihai/cpython/Lib/test/test__xxsubinterpreters.py", line 49, in 
run
interpreters.run_string(interp, dedent(f"""
RuntimeError: unrecognized interpreter ID 60
test test__xxsubinterpreters failed.


According to above details, there are several possible explanations:
1.Some race condition break the opcode execution order.
  I checked the eval function. I didn't find that any condition will disrupt 
the execution order.
2.The running thread hasn't get the GIL in time.
  "RuntimeError: unrecognized interpreter ID 60" proves that the interp has 
been executed in _running(), but later than the test_already_running. So I 
creates PR 26598. But I catch the error again with PR 26598.
3.the running thread can't get the time slice of CPU.
  By running python with add_printf_to_get_details_from_race_condition.patch, I 
find that the thread created in _running() has be executed, but the interp 
hasn't been executed immediately in run(). At the same time, the done.set() has 
been executed in run(), so I guess the real reason is the thread created in 
_running() hasn't get the time slice of CPU to run interp in run() in 
multiprocess.

Pls correct me if I am wrong.

--
Added file: 
https://bugs.python.org/file50160/add_printf_to_get_details_from_race_condition.patch

___
Python tracker 

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



[issue44549] BZip 1.0.6 Critical Vulnerability

2021-07-19 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue44675] Cross-platform issues with private methods and multiprocessing

2021-07-19 Thread Jeremy


New submission from Jeremy :

While writing a program using the multiprocessing library I stumbled upon what 
appears to be a bug with how different platforms deal with private methods.

When a class has a private method which is the target for a multiprocessing 
process, this name is correctly resolved on Linux (20.04.1-Ubuntu running 
Python 3.8.10) but fails to be resolved correctly on MacOS (Python 3.8.2 and 
3.8.8) or Windows 10 (Python 3.9.6).


import multiprocessing

class Test(object):
def __init__(self):
self.a = 1
self._b = 2
self.__c = 3
self.run1()
self.run2()
def _test1(self, conn):
conn.send(self._b)
def __test2(self, conn):
conn.send(self.__c)
def run1(self):
print("Running self._test1()")
parent, child = multiprocessing.Pipe()
process = multiprocessing.Process(target=self._test1, args=(child, ))
process.start()
print(parent.recv())
process.join()
def run2(self):
print("Running self.__test2()")
parent, child = multiprocessing.Pipe()
process = multiprocessing.Process(target=self.__test2, args=(child, ))
process.start()
print(parent.recv())
process.join()

if __name__ == "__main__":
t = Test()


On Linux, this has the intended behavior of printing:
Running self._test1()
2
Running self.__test2()
3

However, on Windows 10, this results in an Exception being raised:
Running self._test1()
2
Running self.__test2()
Traceback (most recent call last):
  File "", line 1, in 
  File 
"C:\Users\\AppData\Local\Programs\Python\Python39\lib\multiprocessing\spawn.py",
 line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
  File 
"C:\Users\\AppData\Local\Programs\Python\Python39\lib\multiprocessing\spawn.py",
 line 126, in _main
self = reduction.pickle.load(from_parent)
AttributeError: 'Test' object has no attribute '__test2'

A similar exception is also raised on MacOS for this code.


It would therefore appear that there is different behavior for resolving class 
attributes starting with `__` on different platforms (at least within 
multiprocessing). It is my understanding that because multiprocessing.Process 
is called within the class, the private method should be within scope and so 
should resolve correctly.
I'm aware that Python doesn't have strict private methods, and instead renames 
them (Test.__test2 becomes Test._Test__test2) - explaining why on Windows it 
cannot find the attribute with that name. 

My question really is, which platform is correct here, and is the inconsistency 
intentional? I'd suggest Linux is most correct here as the process is spawned 
from within the object so the method should be in scope, but either way, the 
inconsistency between platforms may cause some unintended issues.

--
components: Library (Lib), Windows, macOS
messages: 397810
nosy: ned.deily, paul.moore, ronaldoussoren, steve.dower, tim.golden, ymerej, 
zach.ware
priority: normal
severity: normal
status: open
title: Cross-platform issues with private methods and multiprocessing
type: 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



[issue44549] BZip 1.0.6 Critical Vulnerability

2021-07-19 Thread Dong-hee Na


Dong-hee Na  added the comment:

@ned.deily

Is it possible to update bz2 to 1.0.8 on macOS distribution?
I found the guide to update the library on Windows but for the macOS version, I 
can not find.

--
nosy: +ned.deily

___
Python tracker 

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



[issue44549] BZip 1.0.6 Critical Vulnerability

2021-07-19 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +25790
pull_request: https://github.com/python/cpython/pull/27241

___
Python tracker 

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



[issue37224] [subinterpreters] test__xxsubinterpreters fails randomly

2021-07-19 Thread hai shi


Change by hai shi :


--
pull_requests: +25789
pull_request: https://github.com/python/cpython/pull/27240

___
Python tracker 

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



[issue44549] BZip 1.0.6 Critical Vulnerability

2021-07-19 Thread Dong-hee Na


Change by Dong-hee Na :


--
components: +macOS
nosy: +ronaldoussoren
type: crash -> security

___
Python tracker 

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



[issue27513] email.utils.getaddresses does not handle Header objects

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 89f4c34797de2f0e5045da2b97c1c8cbbb42fbb2 by Zackery Spytz in 
branch 'main':
bpo-27513: email.utils.getaddresses() now handles Header objects (#13797)
https://github.com/python/cpython/commit/89f4c34797de2f0e5045da2b97c1c8cbbb42fbb2


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue27513] email.utils.getaddresses does not handle Header objects

2021-07-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +25791
pull_request: https://github.com/python/cpython/pull/27242

___
Python tracker 

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



[issue44549] BZip 1.0.6 Critical Vulnerability

2021-07-19 Thread Dong-hee Na


Dong-hee Na  added the comment:

Hmm since I am not a distribution expert, I would like to follow other core 
devs opinions.

Almost Linux distributions use bzip2 1.0.6 by default.

--

___
Python tracker 

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



[issue44676] Add ability to serialise types.Union

2021-07-19 Thread Yurii Karabas


New submission from Yurii Karabas <1998uri...@gmail.com>:

It was discussed at https://bugs.python.org/issue44490

--
messages: 397814
nosy: uriyyo
priority: normal
severity: normal
status: open
title: Add ability to serialise types.Union

___
Python tracker 

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



[issue44676] Add ability to serialise types.Union

2021-07-19 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
versions: +Python 3.11

___
Python tracker 

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



[issue44662] Add ability to annotate types.Union

2021-07-19 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
title: Add ability to serialise and annotate types.Union -> Add ability to 
annotate types.Union

___
Python tracker 

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



[issue44676] Add ability to serialise types.Union

2021-07-19 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
type:  -> enhancement

___
Python tracker 

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



[issue27513] email.utils.getaddresses does not handle Header objects

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 8c43bf1a923754fa6d97772151c6ac23c48759d3 by Miss Islington (bot) 
in branch '3.10':
bpo-27513: email.utils.getaddresses() now handles Header objects (GH-13797) 
(GH-27242)
https://github.com/python/cpython/commit/8c43bf1a923754fa6d97772151c6ac23c48759d3


--

___
Python tracker 

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



[issue27513] email.utils.getaddresses does not handle Header objects

2021-07-19 Thread Łukasz Langa

Change by Łukasz Langa :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.11 -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



[issue44676] Add ability to serialise types.Union

2021-07-19 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


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

___
Python tracker 

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



[issue27513] email.utils.getaddresses does not handle Header objects

2021-07-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25793
pull_request: https://github.com/python/cpython/pull/27245

___
Python tracker 

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



[issue44662] Add ability to annotate types.Union

2021-07-19 Thread Ken Jin


Ken Jin  added the comment:

Nosied over people from issue44490. This issue addresses msg396895:

Thanks to Ruben for the catch. (message copied over):
```
It also lacks the __module__ attribute, causing it to be unusable in PEP 593 
typing.Annotated types:

from typing import Annotated
x: Annotated[int | str, 'test']

Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/ruben/.pyenv/versions/3.10.0b3/lib/python3.10/typing.py", line 
298, in inner
return cached(*args, **kwds)
  File "/Users/ruben/.pyenv/versions/3.10.0b3/lib/python3.10/typing.py", line 
1594, in __class_getitem__
return _AnnotatedAlias(origin, metadata)
  File "/Users/ruben/.pyenv/versions/3.10.0b3/lib/python3.10/typing.py", line 
1520, in __init__
super().__init__(origin, origin)
  File "/Users/ruben/.pyenv/versions/3.10.0b3/lib/python3.10/typing.py", line 
976, in __init__
self.__module__ = origin.__module__
AttributeError: 'types.Union' object has no attribute '__module__'. Did you 
mean: '__reduce__'?
```

--
nosy: +ROpdebee, gvanrossum, kj, serhiy.storchaka
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



[issue44672] Final "pass" is traced incorrectly in 3.9 (and before)

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks for reporting, Ned. I agree with Mark though.

We've done 7 releases of Python 3.9 already. The later in the release cycle for 
a given Python version, the less it's clear if it's "worth" performing complex 
fixes. Most importantly because introducing a large functional change at this 
point is risky and we try hard not to disrupt users of stable versions. 
Moreover, our experience shows that later bugfix releases see decreasing 
adoption because by default downstream distributors keep their original early 
bugfix versions of Python with only security- and build-related fixes ported 
from later releases in the same series.

--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset bce1418541a64a793960182772f985f64afbfa1a by Yurii Karabas in 
branch 'main':
bpo-44524: Add missed __name__ and __qualname__ to typing module objects 
(#27237)
https://github.com/python/cpython/commit/bce1418541a64a793960182772f985f64afbfa1a


--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread Łukasz Langa

Change by Łukasz Langa :


--
versions: +Python 3.10, Python 3.11 -Python 3.9

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks! ✨ 🍰 ✨

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +25794
pull_request: https://github.com/python/cpython/pull/27246

___
Python tracker 

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



[issue27513] email.utils.getaddresses does not handle Header objects

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 9ee12cf325d4da2c07919e5e56545feb7e005e08 by Miss Islington (bot) 
in branch '3.9':
bpo-27513: email.utils.getaddresses() now handles Header objects (GH-13797) 
(#27245)
https://github.com/python/cpython/commit/9ee12cf325d4da2c07919e5e56545feb7e005e08


--

___
Python tracker 

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



[issue44677] CSV sniffing falsely detects space as a delimiter

2021-07-19 Thread Piotr Tokarski


New submission from Piotr Tokarski :

Let's consider the following CSV content: "a|b\nc| 'd\ne|' f". The real 
delimiter in this case is '|' character while ' ' is sniffed. Find verbose 
example attached.

Problem lays in csv.py file in the following code:

```
matches = []
for restr in (r'(?P[^\w\n"\'])(?P 
?)(?P["\']).*?(?P=quote)(?P=delim)', # ,".*?",
  
r'(?:^|\n)(?P["\']).*?(?P=quote)(?P[^\w\n"\'])(?P ?)',   # 
 ".*?",
  r'(?P[^\w\n"\'])(?P 
?)(?P["\']).*?(?P=quote)(?:$|\n)',   # ,".*?"
  r'(?:^|\n)(?P["\']).*?(?P=quote)(?:$|\n)'):
#  ".*?" (no delim, no space)
regexp = re.compile(restr, re.DOTALL | re.MULTILINE)
matches = regexp.findall(data)
if matches:
break
```

What makes matches non-empty and farther processing happens with delimiter 
falsely set to ' '.

--
components: Library (Lib)
messages: 397821
nosy: pt12lol
priority: normal
severity: normal
status: open
title: CSV sniffing falsely detects space as a delimiter
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +25795
pull_request: https://github.com/python/cpython/pull/27247

___
Python tracker 

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



[issue42854] OpenSSL 1.1.1: use SSL_write_ex() and SSL_read_ex()

2021-07-19 Thread Geoffrey Thomas


Geoffrey Thomas  added the comment:

I am still seeing failures to read responses over 2 GB in Python 3.10b1. I'm 
working on a reproducer, but I'm getting the same "OverflowError: signed 
integer is greater than maximum" that I get in 3.9.

--
nosy: +geofft

___
Python tracker 

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



[issue44668] More differences in instance and subclass checks between typing.Union and types.Union

2021-07-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Sure.

--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-19 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c895f2bc4f270efce30fe3687ce85095418175f4 by Miss Islington (bot) 
in branch '3.10':
bpo-44524: Add missed __name__ and __qualname__ to typing module objects 
(GH-27237) (#27246)
https://github.com/python/cpython/commit/c895f2bc4f270efce30fe3687ce85095418175f4


--

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Yurii Karabas


Yurii Karabas <1998uri...@gmail.com> added the comment:

@Ken thanks for pointing this out.

The only solution which I see is to convert NewType into callable class but it 
will lead to performance degradation.

@Ken what do you think about that?

--

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Do we have to solve it? Using `from __future__ import annotations` it should 
work, at least when used as an annotation. Or is that too inconvenient or 
inconsistent?

--

___
Python tracker 

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



[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is also problem with other typing types:

>>> (int | T)[typing.List]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Each union argument must be a type, got typing.List
>>> (int | T)[typing.List[int]]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Each union argument must be a type, got typing.List[int]
>>> (int | T)[typing.Hashable]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Each union argument must be a type, got typing.Hashable
>>> (int | T)[typing.Callable[[int], str]]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Each union argument must be a type, got typing.Callable[[int], str]
>>> (int | T)[typing.ParamSpec('P')]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Each union argument must be a type, got ~P

Despite the fact that they support the | operator.

We can add one by one special support of different types supporting the | 
operator (ParamSpec, _GenericAlias, _CallableGenericAlias, _UnionGenericAlias, 
_LiteralGenericAlias, _ConcatenateGenericAlias, _AnnotatedAlias, 
_SpecialGenericAlias, _CallableType, _TupleType), but it is cumbersome and 
errorprone. We will need to synchronize code of unionobject.c with typing every 
time we add new kind of types.

PR 27247 uses more general approach. It calls the | operator for arguments 
after substitution. So all types which support the | operator are now 
automatically supported. But the result of parameter substitution can now be 
typing.Union instead of types.Union.

>>> import typing
>>> import collections.abc
>>> T = typing.TypeVar('T')
>>> (int | T)[list]
int | list
>>> (int | T)[typing.List]
typing.Union[int, typing.List]
>>> (int | T)[list[int]]
int | list[int]
>>> (int | T)[typing.List[int]]
typing.Union[int, typing.List[int]]
>>> (int | T)[collections.abc.Hashable]
int | collections.abc.Hashable
>>> (int | T)[typing.Hashable]
typing.Union[int, typing.Hashable]
>>> (int | T)[collections.abc.Sequence[int]]
int | collections.abc.Sequence[int]
>>> (int | T)[typing.Sequence[int]]
typing.Union[int, typing.Sequence[int]]
>>> (int | T)[collections.abc.Callable[[int], str]]
int | collections.abc.Callable[[int], str]
>>> (int | T)[typing.Callable[[int], str]]
typing.Union[int, typing.Callable[[int], str]]
>>> (int | T)[typing.TypeVar('S')]
int | ~S
>>> (int | T)[typing.ParamSpec('P')]
typing.Union[int, ~P]
>>> (int | T)[str | list]
int | str | list
>>> (int | T)[typing.Union[str, list]]
typing.Union[int, str, list]

--

___
Python tracker 

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



[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

I need someone else to own this, sorry.

--

___
Python tracker 

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



[issue43950] Include column offsets for bytecode instructions

2021-07-19 Thread Ammar Askar

Ammar Askar  added the comment:

Had some time to look into this. Just to summarize this problem, it deals with 
unicode points that are single characters but take up more than the width of a 
single character, even with a monospace font [1].

In the examples from above, the Chinese character itself counts as one 
character in a Python string. However, notice that it needs two carets:

>>> x = "该"
>>> print(x)
该
>>> len(x)
1
>>> print(x + '\n' + '^^')
该
^^

This issue is somewhat font dependent, in the case of the emoji I know that 
windows sometimes renders emojis as single-character wide black-and-white 
glyphs or colorful ones depending on the program.

As Pablo alluded to, unicodedata.east_asian_width is probably the best solution 
we can implement. For these wide characters it provides:

>>> unicodedata.east_asian_width('💩')
'W'
>>> unicodedata.east_asian_width('该')
'W'

W corresponding to Wide. Whereas for regular width characters:

>>> unicodedata.east_asian_width('b')
'Na'
>>> unicodedata.east_asian_width('=')
'Na'

we get Neutral (Not East Asian). This can be used to count the "displayed 
width" of the characters and hence the carets. However, organization is going 
to be a bit tricky since we're currently using 
_PyPegen_byte_offset_to_character_offset to get offsets to use for string 
slicing in the ast segment parsing code. We might have to make a separate 
function that gets the font display-width.

-

[1] Way more details on this issue here: 
https://denisbider.blogspot.com/2015/09/when-monospace-fonts-arent-unicode.html 
and an example of a Python library that tries to deal with this issue here: 
https://github.com/jquast/wcwidth

--

___
Python tracker 

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



[issue44672] Final "pass" is traced incorrectly in 3.9 (and before)

2021-07-19 Thread Ned Batchelder


Ned Batchelder  added the comment:

This is the right call.  Thanks!

--

___
Python tracker 

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



[issue44678] Seperate error message for discontinuous padding in binascii.a2b_base64 strict mode

2021-07-19 Thread Idan Moral


New submission from Idan Moral :

This is a follow-up PR to #24402.

It should address @gpshead's last comment on the subject:
https://github.com/python/cpython/pull/24402#issuecomment-882699002

Original issue: https://bugs.python.org/issue43086
Original PR: https://github.com/python/cpython/pull/24402

--
components: Extension Modules, Library (Lib)
messages: 397831
nosy: gregory.p.smith, idan22moral
priority: normal
severity: normal
status: open
title: Seperate error message for discontinuous padding in binascii.a2b_base64 
strict mode
versions: Python 3.11

___
Python tracker 

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



[issue44678] Seperate error message for discontinuous padding in binascii.a2b_base64 strict mode

2021-07-19 Thread Idan Moral


Change by Idan Moral :


--
type:  -> enhancement

___
Python tracker 

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



[issue42854] OpenSSL 1.1.1: use SSL_write_ex() and SSL_read_ex()

2021-07-19 Thread Geoffrey Thomas


Geoffrey Thomas  added the comment:

Christian mentioned on Twitter that this is probably due to a missing argument 
clinic change from "int" to "Py_ssize_t". I can confirm that fixing that and 
rerunning argument clinic makes things start to work.

I don't have the ability to reopen this bug (I think), can someone reopen it 
please?

--

___
Python tracker 

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



[issue43086] Excess data in not handled properly in binascii.a2b_base64()

2021-07-19 Thread Idan Moral


Change by Idan Moral :


--
pull_requests: +25796
pull_request: https://github.com/python/cpython/pull/27249

___
Python tracker 

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



[issue42854] OpenSSL 1.1.1: use SSL_write_ex() and SSL_read_ex()

2021-07-19 Thread Filipe Laíns

Filipe Laíns  added the comment:

https://twitter.com/geofft/status/1417167982665551877

--
nosy: +FFY00
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue44678] Seperate error message for discontinuous padding in binascii.a2b_base64 strict mode

2021-07-19 Thread Idan Moral


Change by Idan Moral :


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

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

> Using `from __future__ import annotations` it should work

Not in type aliases or generic bases. (And if Larry's co_annotations PEP is 
accepted, it would break in normal annotations too.) I'd prefer to get rid of 
this sort of subtle difference where the obvious way to write a type only works 
in some contexts, though I realize that's not possible in all cases.

That means I think we should move forward with making NewTypes into instances 
with __call__ instead of functions, though according to my benchmarks in the 
typing issue that will incur a small performance penalty.

--

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


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

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Yurii Karabas


Yurii Karabas <1998uri...@gmail.com> added the comment:

I opened PR with refactored `typing.NewType` into callable class.

Also I have added `__module__` attr to typing.NewType so it will become 
pickable.

--

___
Python tracker 

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



[issue31162] urllib.request.urlopen CERTIFICATE_VERIFY_FAILED error

2021-07-19 Thread Jacob Walls


Jacob Walls  added the comment:

Third voice chiming in to say not a bug, also. I think the last two messages 
inadvertently moved to pending and then back to open. I suggest closing.

--
nosy: +jacobtylerwalls

___
Python tracker 

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



[issue43950] Include column offsets for bytecode instructions

2021-07-19 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The effort to match caret lines to general unicode is similar to a previous 
issue that was closed as futile.  (But I could not find it.)  It has a downside 
that should be considered.

The fundamental problem is that there is no fixed pitch font for unicode. (Let 
alone any font covering all of unicode.) Nor is there a single-double width 
definition, or font, for all of unicode.  Some character sets are not amenable 
to such treatment.

To see the problem easier, open, for instance, IDLE's option/settings dialog, 
showing the fonts tab and a multi-script sample.  On Windows, select what I 
believe is the most 'fixed' font -- Courier New.  ASCII, Latin1, IPA, Greek, 
Cyrillic, Hebrew, and Arabic are all rendered in the same fixed pitch.  But the 
last 4 Cyrillic characters of "...ЪъЭэѠѤѬӜ" are extremely cramped and may be 
rendered differently from the rest.  The East Asian characters are in a 
different fixed pitch, about 1.6 times the Ascii, etc. fixed pitch.  (So the 
double-wide 2 is 1.6 rounded up.  And with some fonts, the East Asian scripts 
are not all the same pitch.)  The South Asian script are variable pitch and for 
the sample chars, average wider than 1 (they have 20 chars, like the Ascii, 
etc, lines).  Tamil, especially, has a wide range of widths, with the widest as 
wide as the East Asian chars.

On Windows, on my machine, pasting the sample text between quotes results in 
the Greek chars, the last 4 Cyrillic chars, and all Asian chars (including 
Hebrew and Arabic) being replaced by replacement chars.  (I thought that this 
was better once, but maybe I mis-remember.)  While one can get script-specific 
fonts, the fixed-pitch South Asian fonts I tried on Mac were hardly readable.  
My conclusion is that people using certain scripts and anyone wanting a wide 
variety of scripts needs to use a GUI-based editor and shell rather than a 
fixed-pitch terminal/console.

As long as the caret line has 1 char per code char, a GUI program can use it to 
mark code characters, and do so differently for '~' and '^'.  If some of these 
chars are doubled, exact character information is lost.  If you go ahead with 
this, please use a third character, such as '-', for additions.  GUI programs 
could then ignore these, given that they can otherwise can get the start 
character information.

--

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Jelle, can you post more details about your benchmark?

--

___
Python tracker 

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



[issue44679] unittest.mock.sentinel documentation typo

2021-07-19 Thread Andrii Haidai


New submission from Andrii Haidai :

here: 
https://docs.python.org/3.3/library/unittest.mock.html#sentinel
in code example block in last command line
>>> sentinel.some_object
according to the above 26.4.5.1 article context it looks like the other commad 
is expected:
>>> result
To ensure that at the end "result" equals sentinel.some_object we probably 
should print the "result" value to check, not the "sentinel.some_object" itself.

--
assignee: docs@python
components: Documentation
messages: 397839
nosy: docs@python, gaydayav
priority: normal
severity: normal
status: open
title: unittest.mock.sentinel documentation typo
versions: Python 3.6

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Jelle Zijlstra

Jelle Zijlstra  added the comment:

This is what I got last year (copied from the typing issues):

In [83]: from typing import NewType

In [84]: nt = NewType("nt", int)

In [85]: class NewTypeClass:
...: def __init__(self, name, supertype):
...: self.name = name
...: self.supertype = supertype
...: def __call__(self, obj):
...: return obj
...: def __repr__(self):
...: return f""
...: 

In [86]: ntc = NewTypeClass("ntc", int)

In [87]: ntc
Out[87]: 

In [88]: %timeit nt(3)
211 ns ± 2.27 ns per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [89]: %timeit ntc(3)
253 ns ± 5.35 ns per loop (mean ± std. dev. of 7 runs, 100 loops each)


Not sure what version of Python I used at the time. I just repeated it on 3.9.4 
MacOS and got much faster time but a similar ~20% slowdown:

In [6]: %timeit nt(3)
112 ns ± 5.11 ns per loop (mean ± std. dev. of 7 runs, 1000 loops each)

In [7]: %timeit ntc(3)
136 ns ± 2.36 ns per loop (mean ± std. dev. of 7 runs, 1000 loops each)

--

___
Python tracker 

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



[issue44554] pdb.main is unnecessarily complicated

2021-07-19 Thread Irit Katriel


Change by Irit Katriel :


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



[issue44680] Reference cycles from a WeakKeyDictionary value to its key aren’t collected

2021-07-19 Thread Anders Kaseorg

New submission from Anders Kaseorg :

Because WeakKeyDictionary unconditionally maintains strong references to its 
values, the garbage collector fails to collect a reference cycle from a 
WeakKeyDictionary value to its key.  For example, the following program 
unexpectedly leaks memory:

from weakref import WeakKeyDictionary
class C: pass
d = WeakKeyDictionary()
while True:
c = C()
d[c] = [c]

I would expect a WeakKeyDictionary value to be marked live _if_ its key is 
marked live, not unconditionally.  This could be implemented with garbage 
collector support for ephemerons 
(https://www.researchgate.net/publication/221320677_Ephemerons_A_New_Finalization_Mechanism).

To motivate this issue, a typical use of WeakKeyDictionary is as a hygienic 
replacement for patching extra properties into third-party objects:

# before:
obj._extra_state = ExtraState(obj)
# after:
extra_states = WeakKeyDictionary()
extra_states[o] = ExtraState(obj)

However, such a conversion will introduce this memory leak if ExtraState(obj) 
has any transitive references to obj.

This leak does not occur in JavaScript:

class C {}
const d = new WeakMap();
while (true) {
  const c = new C();
  d[c] = [c];
}

--
components: Library (Lib)
messages: 397841
nosy: andersk
priority: normal
severity: normal
status: open
title: Reference cycles from a WeakKeyDictionary value to its key aren’t 
collected
type: resource usage
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



[issue44353] PEP 604 NewType

2021-07-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Hm, 20% isn't so bad, but one of the arguments for NewType was that it 
"disappears" at runtime -- which the current version does, but the class-based 
version doesn't quite.

Right now I don't have the cycles to think about this deeply. Maybe a few weeks 
after I'm back from vacation (~August 8) I will have more time.

--

___
Python tracker 

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



[issue44678] Seperate error message for discontinuous padding in binascii.a2b_base64 strict mode

2021-07-19 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 366fcbac18e3adc41e3901580dbedb6a91e41a10 by Idan Moral in branch 
'main':
bpo-44678: Separate error message for discontinuous padding in 
binascii.a2b_base64 strict mode (GH-27249)
https://github.com/python/cpython/commit/366fcbac18e3adc41e3901580dbedb6a91e41a10


--

___
Python tracker 

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



[issue43950] Include column offsets for bytecode instructions

2021-07-19 Thread Ammar Askar


Ammar Askar  added the comment:

I think this is the previous issue you are talking about Terry. 
https://bugs.python.org/issue24665

The correct algorithm is a little more complex than just using 
east_asian_widths. Ideally we would like to use the wcwidth function 
(https://man7.org/linux/man-pages/man3/wcwidth.3.html) which implements all the 
logic to somewhat properly figure out widths.

Given Terry's comments from above and the previous issues I'm starting to think 
the fix for this issue might not be worth the added complexity.

--

___
Python tracker 

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



[issue44680] Reference cycles from a WeakKeyDictionary value to its key aren’t collected

2021-07-19 Thread Anders Kaseorg


Anders Kaseorg  added the comment:

> extra_states[o] = ExtraState(obj)

(Typo for extra_states[obj] = ExtraState(obj), obviously.)

--

___
Python tracker 

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



[issue44621] Python 3.9 traces async for/else incorrectly

2021-07-19 Thread Ned Batchelder


Ned Batchelder  added the comment:

@lukasz.langa, I guess this 3.9 tracing bug should also be closed as wont-fix?

--

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Ken Jin


Ken Jin  added the comment:

This issue is now out of date on. After Serhiy's refactoring, any function 
types can be unioned.

>>> NewType('x', int)
>>> int | NewType('x', int)
int | typing.NewType..new_type

The only problem now is that the repr is weird, but Serhiy also has a fix for 
that in issue34963 (PR 9951) without converting to a class.

Thus, I am closing the issue. Please go to issue44642 for a general discussion 
on whether union should support arbitrary functions at all, or issue34963 for 
the repr problem. Thanks all!

--
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed
superseder:  -> Union of a type and the typing module function

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Does that work if you try to union two NewTypes?

--

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-07-19 Thread Ken Jin


Ken Jin  added the comment:

> Does that work if you try to union two NewTypes?

Oh woops I was too eager in closing this issue -- it doesn't work. Sorry, 
please disregard my previous message. I'm reopening this. Thanks for the 
reminder Jelle.

--
resolution: out of date -> 
status: closed -> open

___
Python tracker 

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



[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Thereisfood


New submission from Thereisfood :

time.sleep(0.001) sleeps for 0.014 - 0.016 instead of 0.001.

--
components: Windows
files: Capture.PNG
messages: 397850
nosy: paul.moore, steve.dower, therenoisfood, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: time.sleep(0.001) not working properly
versions: Python 3.9
Added file: https://bugs.python.org/file50161/Capture.PNG

___
Python tracker 

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



[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Thereisfood


Change by Thereisfood :


Removed file: https://bugs.python.org/file50161/Capture.PNG

___
Python tracker 

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



[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Thereisfood


Change by Thereisfood :


Added file: https://bugs.python.org/file50162/Capture.PNG

___
Python tracker 

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



[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Jack DeVries

Jack DeVries  added the comment:

This is not a bug. See the docs:

The precision of the various real-time functions may be less than suggested by 
the units in which their value or argument is expressed. E.g. on most Unix 
systems, the clock “ticks” only 50 or 100 times a second.

On the other hand, the precision of time() and sleep() is better than their 
Unix equivalents: times are expressed as floating point numbers, time() returns 
the most accurate time available (using Unix gettimeofday() where available), 
and sleep() will accept a time with a nonzero fraction (Unix select() is used 
to implement this, where available).



Assuming a clock speed of 50x/second as the documentation names, the cpu only 
cycles every 0.02 seconds.

--
nosy: +jack__d

___
Python tracker 

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



  1   2   >