[issue44553] types.Union should support GC

2021-07-03 Thread Ken Jin


Ken Jin  added the comment:

Oh I didn't see Pablo's message on the PR:

> @Fidget-Spinner For next occasions, the problem with this is that 
> PyObject_GC_Del cannot be called like that because it overrides a bunch of 
> cleanups like the call to _Py_ForgetReference and other possible handling.

Thanks for the explanation!

--

___
Python tracker 

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



[issue44559] Enum: revert to 3.9

2021-07-03 Thread Ethan Furman


Change by Ethan Furman :


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



[issue44559] Enum: revert to 3.9

2021-07-03 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 9bf7c2d638a582af2444bc864feba13ab8957b68 by Ethan Furman in 
branch '3.10':
[3.10] bpo-44559: [Enum] revert enum module to 3.9 (GH-27010)
https://github.com/python/cpython/commit/9bf7c2d638a582af2444bc864feba13ab8957b68


--

___
Python tracker 

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



[issue43474] http.server.BaseHTTPRequestHandler end_header() fails

2021-07-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Why do you need to `end_headers()` before first doing `send_header()`?

I guess the normal use should be:

if headers:
  for h in headers: send_header(h)
  end_headers()

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44559] Enum: revert to 3.9

2021-07-03 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 

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



[issue44559] Enum: revert to 3.9

2021-07-03 Thread Ethan Furman

New submission from Ethan Furman :

>From the SC (was Re: Enum -- last call for comments on 3.10 changes)

> The Steering Council discussed this topic at our meeting yesterday.  We have 
> some
> discomfort about the changes to Enum’s str and repr in Python 3.10, both in 
> the
> specific changes and in the way the changes were decided on.  No knock on 
> Ethan or
> others who participated in those decisions, it’s just that to us, the changes
> cumulatively feel like they need a more formal, centralized discussion to 
> understand
> all the issues in detail.
> 
> While we’re stopping short of requiring it, the Steering Council strongly 
> suggests that
> for Python 3.10, the changes in Enum’s str and repr be reverted back to the 
> Python 3.9
> behavior, and that a PEP be written for Python 3.11.

The changes were primarily spurred both by the changes to re.RegexFlag and by 
unfortunate choices made in enum.Flag regarding aliases and iteration that were 
corrected.

Unfortunately, it proved too difficult to revert the Flag repr() while keeping 
the corrections, so the entire enum module is being reverted to its 3.9 version.

All the bug-fixes, performance improvements, and other enhancements will have 
to wait for 3.11.

--
assignee: ethan.furman
components: Library (Lib)
messages: 396935
nosy: barry, brett.cannon, ethan.furman, pablogsal, twouters, willingc
priority: release blocker
severity: normal
status: open
title: Enum: revert to 3.9
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



[issue43418] FTPLib error when server returns byte message instead of string

2021-07-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This is an issue with cowrie, I've commented on it here: 
https://github.com/cowrie/cowrie/issues/1394 .

In short, cowrie overrides FTP class and opens `self.file` in binary mode. 
Various FTP methods will break or work incorrectly if `self.file` is in binary 
mode.

This can be closed as not a bug.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44530] Propagate qualname from the compiler unit to code objects for finer grained profiling data

2021-07-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> So that seems to be about half a MB increase over 25 MB (about 2% relative 
> increase).

I personally think that is acceptable, so I would be supportive of the patch 
but for context, many folks have indicated that they are worried about this 
size getting bigger during previous discussions, so we need to still think 
collectively :)

--

___
Python tracker 

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



[issue44530] Propagate qualname from the compiler unit to code objects for finer grained profiling data

2021-07-03 Thread Gabriele N Tornetta


Gabriele N Tornetta  added the comment:

> That is a pointer size per code object. The most standard way is to calculate 
> the size of all pyc files in the stdlib after compiling them all with "-m 
> compileall -r 1000 Lib".

This yields the following numbers between what was main when I branched off and 
the tip of my branch:

# main (7569c0fe91): 25_059_438 bytes
# bpo-445303-code-qualname (a0252ab9ad): 25_511_492 bytes

So that seems to be about half a MB increase over 25 MB (about 2% relative 
increase).

This is potentially just an interim result, as at first sight it looks like 
MAKE_FUNCTION could require one less argument (the qualname), which can now be 
taken from the code object. So not quite the final picture yet.

--

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread Ken Jin


Ken Jin  added the comment:

Woops, thanks for the quick fix Pablo. I'm guessing the takeaway here is
that we should start tracking a GC-ed object as early as possible?

--

___
Python tracker 

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



[issue44530] Propagate qualname from the compiler unit to code objects for finer grained profiling data

2021-07-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Is there a "standard" way for me to quantify the memory impact of these kinds 
> of changes?

That is a pointer size per code object. The most standard way is to calculate 
the size of all pyc files in the stdlib after compiling them all with "-m 
compileall -r 1000 Lib".

--

___
Python tracker 

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



[issue35866] concurrent.futures deadlock

2021-07-03 Thread STINNER Victor


STINNER Victor  added the comment:

Great! I close the issue.

--

___
Python tracker 

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



[issue44434] _thread module: Remove redundant PyThread_exit_thread() call to avoid glibc fatal error: libgcc_s.so.1 must be installed for pthread_cancel to work

2021-07-03 Thread STINNER Victor


STINNER Victor  added the comment:

Good news: this change fixed bpo-35866 "concurrent.futures deadlock".

--

___
Python tracker 

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



[issue35866] concurrent.futures deadlock

2021-07-03 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue44530] Propagate qualname from the compiler unit to code objects for finer grained profiling data

2021-07-03 Thread Gabriele N Tornetta


Gabriele N Tornetta  added the comment:

@pablogsal

Commit a0252ab9add7d48e9e0604ebf97342e46cf00419 exposes co_qualname to Python. 
I've added a test case to check that the result coincides with the current 
implementation of __qualname__. Is there a "standard" way for me to quantify 
the memory impact of these kinds of changes?

@Mark.Shannon

I'll look into making __qualname__ use __code__.co_qualname as a next step.

--

___
Python tracker 

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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2021-07-03 Thread Germán Méndez Bravo

Germán Méndez Bravo  added the comment:

Nils, unfortunately, fixing the MRO here won’t fix the issue because 
`TypedDict.__annotations__` in the class copies the annotations from the parent 
classes, and when the type evaluation is made, it’s made using the copied 
annotation found in the bottommost class (which is thus then expected to be a 
forward reference in the same module as the class that inherited them. This 
producing the exact same problem of missing type.

The most likely reason for incomplete MRO is that `TypeDict` extends a class’ 
`__annotations__` with all of it’s parent’s `__annotations__`, so the final 
class has the complete set of annotations of all of its parents, so having the 
full inheritance chain made less sense, after all the final dictionary class 
has all the annotations.

> On Jul 3, 2021, at 13:43, Nils Kattenbeck  wrote:
> 
> 
> Nils Kattenbeck  added the comment:
> 
>> The way I fixed this is I added `__forward_module__` to `typing.ForwardRef`, 
>> so that it can resolve the forward reference with the same globals as the 
>> ones specified by the module in `__forward_module__`. `TypedDict`'s 
>> metaclass should then pass the dictionary’s module name to the annotations’ 
>> forward references via the added `module`’s keyword argument in 
>> `typing._type_check()`. I can work in a pull request with this solution and 
>> discuss any potential problems.
> 
> While this seems like a good solution I would still like to figure out why 
> TypedDict do not preserve MRO. Because for now I have not found a reason nor 
> did someone on the typing-sig mailinglist have a clue. Should there (no 
> longer) be a reason for this then this problem has a trivial solution (just 
> re-add the MRO and use that).
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks for the fix, Pablo!

Ken Jin, we learned something today!

--
nosy: +Guido.van.Rossum

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 000b9e803a7ec067da0a43f9a3fec16f1078215a by Miss Islington (bot) 
in branch '3.10':
bpo-44553: Correct failure in tp_new for the union object (GH-27008) (GH-27009)
https://github.com/python/cpython/commit/000b9e803a7ec067da0a43f9a3fec16f1078215a


--

___
Python tracker 

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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2021-07-03 Thread Nils Kattenbeck

Nils Kattenbeck  added the comment:

> The way I fixed this is I added `__forward_module__` to `typing.ForwardRef`, 
> so that it can resolve the forward reference with the same globals as the 
> ones specified by the module in `__forward_module__`. `TypedDict`'s metaclass 
> should then pass the dictionary’s module name to the annotations’ forward 
> references via the added `module`’s keyword argument in 
> `typing._type_check()`. I can work in a pull request with this solution and 
> discuss any potential problems.

While this seems like a good solution I would still like to figure out why 
TypedDict do not preserve MRO. Because for now I have not found a reason nor 
did someone on the typing-sig mailinglist have a clue. Should there (no longer) 
be a reason for this then this problem has a trivial solution (just re-add the 
MRO and use that).

--

___
Python tracker 

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



[issue15373] copy.copy() does not properly copy os.environment

2021-07-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I think it may be good to deprecate and discourage use of `os.environ.copy()`, 
and add a new method `os.environ.asdict()`. And possibly have `__copy__` raise 
an error pointing users to `os.environ.asdict()`.

I'm not sure what to do about pickling.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue44553] types.Union should support GC

2021-07-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset bc3961485639cc73de7c4c7eed1b56f3c74939bf by Pablo Galindo in 
branch 'main':
bpo-44553: Correct failure in tp_new for the union object (GH-27008)
https://github.com/python/cpython/commit/bc3961485639cc73de7c4c7eed1b56f3c74939bf


--

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25569
pull_request: https://github.com/python/cpython/pull/27009

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +25568
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/27008

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
priority: normal -> release blocker

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This commits seems to have broken the tracerefs buildbots:

https://buildbot.python.org/all/#/builders/484/builds/322
https://buildbot.python.org/all/#/builders/678/builds/127

Please, take a look at soon as possible, otherwise per the buildbot policy we 
will need to revert the commits to avoid masking other issues.

--
nosy: +pablogsal
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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2021-07-03 Thread Germán Méndez Bravo

Germán Méndez Bravo  added the comment:

The way I fixed this is I added `__forward_module__` to `typing.ForwardRef`, so 
that it can resolve the forward reference with the same globals as the ones 
specified by the module in `__forward_module__`. `TypedDict`'s metaclass should 
then pass the dictionary’s module name to the annotations’ forward references 
via the added `module`’s keyword argument in `typing._type_check()`. I can work 
in a pull request with this solution and discuss any potential problems.

--
nosy: +Kronuz

___
Python tracker 

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



[issue44558] operator.countOf `is` / `==` inconsistency

2021-07-03 Thread Rupert Tombs


Change by Rupert Tombs :


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

___
Python tracker 

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



[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-03 Thread Daniel Fleischman


Daniel Fleischman  added the comment:

Thank you again, Dennis.

I would disagree with your conclusion for mainly 3 reasons:

1. The linked list proposal would increase the memory usage by 2 Py_ssize_t per 
entry, plus another 2 for the whole dictionary. I don't think this is an 
overwhelming amount of extra memory for Python, but of course it's open for 
discussion. Insertions and removals would become marginally slower (I'll try to 
measure it), membership wouldn't suffer, and iteration would become O(1) per 
element iterated on. 

2. I think that this case is covered by "Dynamic Mappings" in the document 
you've linked to.

3. This is not about the ordering in ducts being first or second nature. Please 
read the example in bad_dict_example.py to see a bad case where hearing over a 
dict of size 1 can take milliseconds.

I want to reiterate (pun not intended) that this is not a use case for me, but 
it surprised me that dictionaries display this behavior. It's not hard to 
imagine a real use case where it just happens that someone deletes elements 
from a dictionary in insertion order. Or that someone deletes all keys but the 
last inserted (in any order), resulting in a dictionary that takes way too long 
to iterate on. 


Thank you for the discussion. :)

--

___
Python tracker 

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



[issue44558] operator.countOf `is` / `==` inconsistency

2021-07-03 Thread Rupert Tombs


New submission from Rupert Tombs :

operator.countOf behaves differently in its docstring and its c and python 
implementations when `is` and `==` differ.

help(countOf) ->

countOf(a, b, /)
Return the number of times b occurs in a.

This could be read to say that it returns equal to `sum(x is b for x in a)`.

Its python implementation returns `sum(x == b for x in a)`.

Since its c implementation uses `PyObject_RichCompareBool`, it returns `sum(x 
is b or x == b for x in a)`.

Results of these implementations can differ when `x is b` does not imply `x == 
b`;
that could be from an __eq__ method, but the the float NaN is a real example 
since NaN != NaN.


The issue is demonstrated with a possible fix here 
https://godbolt.org/z/cPT7TToG7


Since the c version has been in the wild for decades, I suggest that it should 
be taken to define the function;
the python should be updated to match it, and the docstring could say
"Return the number of items in a which are, or which equal, b."

I will open a pull request with these changes shortly.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 396917
nosy: docs@python, rtombs
priority: normal
severity: normal
status: open
title: operator.countOf `is` / `==` inconsistency
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



[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-03 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

OrderedDict already uses a linked list alongside a dictionary and meets all of 
your timing expectations, but has a higher memory usage, as linked lists 
generally do.

Since so many Python objects use dictionaries under the hood, it would probably 
not be worth it to completely change the dict structure and the memory usage of 
Python as a whole to only benefit this uncommon case. See Objects/dictnotes.txt 
for the highest priority use cases of dicts.

Per the OrderedDict docs, ordering is only secondary for dicts, but it's the 
focus for OrderedDicts. Just like you wouldn't send a list to do the job of a 
deque or vice versa, I don't think you should send an dict to do the job of an 
OrderedDict or vice versa.

--

___
Python tracker 

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



[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-03 Thread Daniel Fleischman


Daniel Fleischman  added the comment:

I think the idea of augmenting the struts to maintain a linked list of elements 
together with periodically shrinking on removal would solve both time and space 
issues, right? 

Space will be always linear, and operations would still be constant amortized 
time (of course the worst case of removing will be linear because of the 
shrinking, but I guess this behavior is expected).

I wrote a worse example in bad_dict_example.py submitted to this issue.  This 
example would be fixed simply by the shrinking, but as is it's a pretty 
unexpected bug, as a simple sum(d.values()) can take milliseconds on a 
dictionary with only one entry (both key and value are int).

--

___
Python tracker 

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



[issue44461] 'Pdb' object has no attribute 'botframe'

2021-07-03 Thread Irit Katriel


Irit Katriel  added the comment:

I've close PR26937 since we're not going for that. The test from it might still 
be useful, so I'm copying it here:

def test_package_without_a_main(self):
pkg_name = 't_pkg'
module_name = 't_main'
os_helper.rmtree(pkg_name)
modpath = pkg_name + '/' + module_name
os.makedirs(modpath)
with open(modpath + '/__init__.py', 'w') as f:
pass
self.addCleanup(os_helper.rmtree, pkg_name)
stdout, stderr = self._run_pdb(['-m', modpath.replace('/', '.')], "")
self.assertIn(
"'t_pkg.t_main' is a package and cannot be directly executed",
stdout)

--

___
Python tracker 

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



[issue34266] Bad behavior with "restart \" or "restart "" in pdb

2021-07-03 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



[issue34266] Bad behavior with "restart \" or "restart "" in pdb

2021-07-03 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 33022f9e86878c84c605de27aae4bd782ecb8da6 by Irit Katriel in 
branch '3.10':
[3.10] bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656) 
(GH-27006)
https://github.com/python/cpython/commit/33022f9e86878c84c605de27aae4bd782ecb8da6


--

___
Python tracker 

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



[issue34266] Bad behavior with "restart \" or "restart "" in pdb

2021-07-03 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 21be6cb0304ba143980b7e4c875cb5b9db30952b by Miss Islington (bot) 
in branch '3.9':
bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656) (GH-27005)
https://github.com/python/cpython/commit/21be6cb0304ba143980b7e4c875cb5b9db30952b


--

___
Python tracker 

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



[issue34266] Bad behavior with "restart \" or "restart "" in pdb

2021-07-03 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6, 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



[issue34266] Bad behavior with "restart \" or "restart "" in pdb

2021-07-03 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +25566
pull_request: https://github.com/python/cpython/pull/27006

___
Python tracker 

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



[issue34266] Bad behavior with "restart \" or "restart "" in pdb

2021-07-03 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset d968a638fcbf9030c999cfacd4c9bf0656e779c4 by Irit Katriel in 
branch 'main':
bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656)
https://github.com/python/cpython/commit/d968a638fcbf9030c999cfacd4c9bf0656e779c4


--

___
Python tracker 

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



[issue34266] Bad behavior with "restart \" or "restart "" in pdb

2021-07-03 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +25565
pull_request: https://github.com/python/cpython/pull/27005

___
Python tracker 

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



[issue35866] concurrent.futures deadlock

2021-07-03 Thread Jakub Wilk


Jakub Wilk  added the comment:

I can no longer reproduce the bug with Python from git.

--

___
Python tracker 

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



[issue44501] Packing constant call arguments

2021-07-03 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> BTW, why do you not fold 2-argument calls?

Seems like it is making stuff worse. 

> I suspect that in most of other examples the function execution time is too 
> large to make the optimization meaningful.

This is (to some extent) a constant folding pass, so I don't think it makes 
sense to expect it to optimize the general workload of the function.

--

___
Python tracker 

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



[issue44501] Packing constant call arguments

2021-07-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Great!

Common examples are str.replace(), re.Match.groups() and __exit__(None, None, 
None). Common anti-patterns include slice(None, None, None) (why not 
slice(None)?) and datetime(1970, 1, 1) (it should be a global constant). I 
suspect that in most of other examples the function execution time is too large 
to make the optimization meaningful.

BTW, why do you not fold 2-argument calls? It would add 2-argument 
str.replace() and str.split().

--

___
Python tracker 

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



[issue44129] zipfile: Add descriptive global variables for general purpose bit flags

2021-07-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your contribution Daniel.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue44129] zipfile: Add descriptive global variables for general purpose bit flags

2021-07-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 556d5ad11fb380868c19beeba53d49f89c27f32d by Daniel Hillier in 
branch 'main':
bpo-44129: Add descriptive global variables for general purpose bit flags 
(GH-26118)
https://github.com/python/cpython/commit/556d5ad11fb380868c19beeba53d49f89c27f32d


--

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-07-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue44501] Packing constant call arguments

2021-07-03 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> I am still not sure that it is worth to add 50 lines of the C code to 
> optimize 0.7% of calls.

As I stated, the reason that this is 'relatively' lower is that there are just 
too many calls, so it just allocates a rather small part of the total pie. 

> Does it include tests?

Yes, to some extent (some packages include tests, some don't). 

> function calls with 3 or 4 constant arguments. Does it include tests? Could 
> you please show several (or several hundreds) non-test examples?

Here are 2 gists (attached together) that contain the locations where such 
function calls are performed within a loop (the first one contains your first 
query, 3 and 4 arguments and the second one contains 5+). 

I added an extra guard to check whether filename starts with test_ or not, so 
it should be generally free of tests (at least the ones that follow the general 
convention). I didn't deal with doing an extreme analysis, it just checks 
whether there call is made under any for/while's loop so there might be some 
false positives. 

https://gist.github.com/isidentical/8743aca3f7815cd19ee71579ca5ba974

--

___
Python tracker 

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



[issue39100] email.policy.SMTP throws AttributeError on invalid header

2021-07-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Anton: thanks for the report! In the message you say you are not sure of the 
solution, and because of that not sending a patch, but then you created the PR; 
- please clarify.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44557] It's a bug? Dict

2021-07-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is not a bug. Assignment in Python does not make a copy, it creates a 
second name for the same object.

--
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44557] It's a bug? Dict

2021-07-03 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This is not a bug since in this case assignment is referring to the same object 
and thus mutating one variable reflects change in other variable.

Relevant FAQ : 
https://docs.python.org/3/faq/programming.html#why-did-changing-list-y-also-change-list-x

--
nosy: +xtreak

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread Ken Jin


Ken Jin  added the comment:

Thanks for the helpful review and merge Serhiy.

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



[issue44553] types.Union should support GC

2021-07-03 Thread miss-islington


miss-islington  added the comment:


New changeset 0856134542c1067d02c9027ddbb2a61916907e92 by Miss Islington (bot) 
in branch '3.10':
bpo-44553 : Implement GC methods for types.Union (GH-26993)
https://github.com/python/cpython/commit/0856134542c1067d02c9027ddbb2a61916907e92


--

___
Python tracker 

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



[issue44557] It's a bug? Dict

2021-07-03 Thread Matheus Oliveira


New submission from Matheus Oliveira :

a = {"a":1}

b = a

a["a"]=33

print(b, a)

# {"a":33}, {"a":33}

--
components: Interpreter Core
messages: 396899
nosy: ymatheus63
priority: normal
severity: normal
status: open
title: It's a bug? Dict
type: resource usage
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



[issue44501] Packing constant call arguments

2021-07-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am still not sure that it is worth to add 50 lines of the C code to optimize 
0.7% of calls.

You have found 7 examples of function calls with 3 or 4 constant arguments. 
Does it include tests? Could you please show several (or several hundreds) 
non-test examples? I am wondering how much of them are in tight loops and are 
not just executed once at module initialization time.

--

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +25563
pull_request: https://github.com/python/cpython/pull/27002

___
Python tracker 

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



[issue44553] types.Union should support GC

2021-07-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 1097384ce964dd63686b1aac706cd0fa764c2dc9 by Ken Jin in branch 
'main':
bpo-44553 : Implement GC methods for types.Union (GH-26993)
https://github.com/python/cpython/commit/1097384ce964dd63686b1aac706cd0fa764c2dc9


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44539] Imghdr JPG Quantized

2021-07-03 Thread Felipe Rodrigues


Change by Felipe Rodrigues :


--
nosy: +fbidu

___
Python tracker 

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



[issue37195] test_utime fails on MacOS Mojave (Kernel Version 18.6.0:)

2021-07-03 Thread Felipe Rodrigues

Felipe Rodrigues  added the comment:

Hi all!

I'm seeing the same error that @pablogsal saw here, but I'm on  Linux Mint 20.1 
x86_64 (Kernel 5.4.0-77):

./python -m test test_os -R : -v
== CPython 3.11.0a0 (heads/pr_26964:d375c08c75, Jul 3 2021, 07:47:01) [GCC 
9.3.0]
== Linux-5.4.0-77-generic-x86_64-with-glibc2.31 little-endian
== cwd: /home/fbidu/collab/cpython/build/test_python_276759æ
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 0.71 Run tests sequentially
0:00:00 load avg: 0.71 [1/1] test_os

(...)

==
FAIL: test_utime (test.test_os.UtimeTests)
--
Traceback (most recent call last):
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 797, in test_utime
self._test_utime(set_time)
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 785, in 
_test_utime
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
AssertionError: 1.0 != 1.002003 within 1e-06 delta (0.0020029977 
difference)

==
FAIL: test_utime_by_indexed (test.test_os.UtimeTests)
--
Traceback (most recent call last):
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 815, in 
test_utime_by_indexed
self._test_utime(set_time)
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 785, in 
_test_utime
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
AssertionError: 1.0 != 1.002003 within 1e-06 delta (0.0020029977 
difference)

==
FAIL: test_utime_by_times (test.test_os.UtimeTests)
--
Traceback (most recent call last):
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 824, in 
test_utime_by_times
self._test_utime(set_time)
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 785, in 
_test_utime
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
AssertionError: 1.0 != 1.002003 within 1e-06 delta (0.0020029977 
difference)

==
FAIL: test_utime_dir_fd (test.test_os.UtimeTests)
--
Traceback (most recent call last):
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 857, in 
test_utime_dir_fd
self._test_utime(set_time)
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 785, in 
_test_utime
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
AssertionError: 1.0 != 1.002003 within 1e-06 delta (0.0020029977 
difference)

==
FAIL: test_utime_directory (test.test_os.UtimeTests)
--
Traceback (most recent call last):
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 863, in 
test_utime_directory
self._test_utime(set_time, filename=self.dirname)
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 785, in 
_test_utime
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
AssertionError: 1.0 != 1.002003 within 1e-06 delta (0.0020029977 
difference)

==
FAIL: test_utime_fd (test.test_os.UtimeTests)
--
Traceback (most recent call last):
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 844, in 
test_utime_fd
self._test_utime(set_time)
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 785, in 
_test_utime
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
AssertionError: 1.0 != 1.002003 within 1e-06 delta (0.0020029977 
difference)

==
FAIL: test_utime_nofollow_symlinks (test.test_os.UtimeTests)
--
Traceback (most recent call last):
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 834, in 
test_utime_nofollow_symlinks
self._test_utime(set_time)
  File "/home/fbidu/collab/cpython/Lib/test/test_os.py", line 785, in 
_test_utime
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
AssertionError: 1.0 != 1.002003 within 1e-06 delta (0.0020029977 
difference)

--

Ran 314 tests in 1.172s

FAILED (failures=7, skipped=46)


Additional info based on what as asked here originally:

./python -m test.pythoninfo
Python debug information


CC.version: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.

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

2021-07-03 Thread ROpdebee


ROpdebee  added the comment:

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

___
Python tracker 

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



[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-03 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Alternate idea: the dict could shrink, if required, on the iter() call, 
whenever a keys/values/items iterator is initialized.

--

___
Python tracker 

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



[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-03 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

> Can https://bugs.python.org/issue32623 be a fix (or mitigation) of this issue?

If such a change is implemented and dictionaries shrink when their fill falls 
below 1/8, the behavior of `while d: del d[next(iter(d))]` will remain 
quadradic: there will be `ma_used - dk_size/8` (linear in len(d)) iterations of 
that loop that scan over half that many dummies on average.

However, such a change could nonetheless speed up `while d: del 
d[next(iter(d))]` by a constant factor. As of now, the loop scans over roughly 
n**2/2 dummies. After that change, assuming the dict starts 1/3 full so the 
size is 3*n, there would be:

(n - 3*n/8)**2 / 2 dummy scans before shrinking => 25/128 * n**2 scans
which would leave 3*n/8 entries remaining, on which the same process would 
repeat.
The total scans would be bounded by
(25/128 * n**2) + (25/128 * (3*n/8)**2) + (25/128 * (9*n/64)**2)) + ...
= 25/128 * n**2 * (1 + 9/64 + 81/4096 + ...)
= 25/128 * n**2 / (1 - 9/64)
= 25/128 * n**2 * (64 / 55)
= 5/22 * n**2

... just under half the number of dummies to scan.

If we were to shrink slightly more aggressively, at a fill of 1/6, it would be 
something like:

(n - 3*n/6)**2 / 2 dummy scans before shrinking => n**2 / 8 scans, leaving 
n/2 remaining
The total would then be bounded by
(n**2 / 8) + ((n/2)**2 / 8) + ((n/4)**2 / 8) + ...
= n**2 / 8 * (1 + 1/4 + 1/16 + ...)
= n**2 / 8 / (1 - 1/4)
= n**2 / 8 * (4 / 3)
= n**2 / 6

... about one third of the number of dummies to scan.

This ignores the linear overhead of actually doing the re-sizing, which would 
dominate on small tables, so maybe there could be some threshold below which 
there would be no shrinking, say 256 (dk_log2_size=8) or so.

--

___
Python tracker 

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



[issue44555] Dictionary operations are LINEAR for any dictionary (for a particular code).

2021-07-03 Thread Inada Naoki


Inada Naoki  added the comment:

Can https://bugs.python.org/issue32623 be a fix (or mitigation) of this issue?

--

___
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-03 Thread Julien Palard


Julien Palard  added the comment:


New changeset 01331f1a3cf86fd308e9a134bb867bf01fb191f5 by Julien Palard in 
branch 'main':
bpo-42238: rstlint: Add two new checks. (GH-26966)
https://github.com/python/cpython/commit/01331f1a3cf86fd308e9a134bb867bf01fb191f5


--

___
Python tracker 

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



[issue44550] Spam

2021-07-03 Thread Mark Dickinson


Change by Mark Dickinson :


--
title: DIGITAL CLASSROOM -> Spam

___
Python tracker 

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