[issue45093] Add method to compare dicts accounting for order

2021-09-03 Thread Michael Rans


Michael Rans  added the comment:

Thanks for all your help and advice.

--

___
Python tracker 

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



[issue45093] Add method to compare dicts accounting for order

2021-09-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> Another case is in round trip processing of JSON or YML.

Sorry for my ignorance, but I don't see how or why an unordered 
comparison would help you with round-tripping JSON or YAML.

The order of key:value pairs in JSON is not guaranteed to be preserved, 
so if you round-trip a dict to JSON back to a dict, and then use an 
ordered comparison, you might wrongly think that they are unequal.

(I think that Python's JSON does preserve order, by default. But other 
JSON encoders might not.)

> Other cases are where you would prefer an OrderedDict over a dict. 

Then use an OrderedDict.

--

___
Python tracker 

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



[issue41010] email.message.EmailMessage.get_body

2021-09-03 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type: crash -> behavior
versions: +Python 3.11 -Python 3.8

___
Python tracker 

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



[issue45086] f-string unmatched ']'

2021-09-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

I don't think it really makes a difference, but here's some background:

For f-strings, the parser itself does not break apart the f-string into 
(, ) parts. There's a custom parser (at 
https://github.com/python/cpython/blob/0b58e863df9970b290a4de90c67f9ac30c443817/Parser/string_parser.c#L837)
 which does that. Then the normal parser is used to parse the expression 
portion.

I think the error shown here is not in the expression parser, but in the 
fstring parser in fstring_find_expr(), at 
https://github.com/python/cpython/blob/0b58e863df9970b290a4de90c67f9ac30c443817/Parser/string_parser.c#L665

As Terry says, it's not incorrect to print the error show in this bug report.

To further diverge:

There's been talk about using the normal parser to pull apart the entire 
f-string, instead of using the two-pass version I mention above. But we've 
never gotten past just talking about it. There are pros and cons for doing it 
with the normal parser, but that's a discussion for a different forum.

--

___
Python tracker 

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



[issue44815] asyncio.gather no DeprecationWarning if task are passed

2021-09-03 Thread Chih-Hsuan Yen


Chih-Hsuan Yen  added the comment:

A regression in 3.9.7 (issue45097) seems related to this issue. Could you have 
a look?

--
nosy: +yan12125

___
Python tracker 

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



[issue45097] "The loop argument is deprecated" reported when user code does not use it

2021-09-03 Thread Chih-Hsuan Yen


New submission from Chih-Hsuan Yen :

With Python 3.9.7, "DeprecationWarning: The loop argument is deprecated" may be 
reported when user code does not use it. Here is an example:

import asyncio
import warnings

warnings.filterwarnings('error')

def crash():
raise KeyboardInterrupt

async def main():
asyncio.get_event_loop().call_soon(crash)
await asyncio.sleep(5)

try:
asyncio.run(main())
except KeyboardInterrupt:
pass

On 3.9.6, no warning is reported, while results on 3.9.7 are

Traceback (most recent call last):
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 629, in 
run_until_complete
self.run_forever()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
self._run_once()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
handle._run()
  File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
  File 
"/home/yen/var/local/Computer/archlinux/community/python-anyio/trunk/cpython-3.9.7-regression.py",
 line 11, in crash
raise KeyboardInterrupt
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/home/yen/var/local/Computer/archlinux/community/python-anyio/trunk/cpython-3.9.7-regression.py",
 line 18, in 
asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 47, in run
_cancel_all_tasks(loop)
  File "/usr/lib/python3.9/asyncio/runners.py", line 64, in _cancel_all_tasks
tasks.gather(*to_cancel, loop=loop, return_exceptions=True))
  File "/usr/lib/python3.9/asyncio/tasks.py", line 755, in gather
warnings.warn("The loop argument is deprecated since Python 3.8, "
DeprecationWarning: The loop argument is deprecated since Python 3.8, and 
scheduled for removal in Python 3.10.

As indicated by the traceback, the loop argument is used inside the asyncio 
library, not from user code. It has been an issue for some time, and the issue 
is exposed after changes for issue44815.

Credit: this example code is modified from an anyio test 
https://github.com/agronholm/anyio/blob/3.3.0/tests/test_taskgroups.py#L943. I 
noticed this issue when I was testing anyio against 3.9.7.

--
components: asyncio
messages: 401032
nosy: asvetlov, yan12125, yselivanov
priority: normal
severity: normal
status: open
title: "The loop argument is deprecated" reported when user code does not use it
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



[issue45093] Add method to compare dicts accounting for order

2021-09-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

-1 also for the reasons given.

Michael, a question asking how would have made a good python-list post. So I 
posted the answers in "How to include insertion order in dict equality"

--
nosy: +terry.reedy
resolution:  -> rejected
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



[issue45093] Add method to compare dicts accounting for order

2021-09-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
Removed message: https://bugs.python.org/msg401022

___
Python tracker 

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



[issue45093] Add method to compare dicts accounting for order

2021-09-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

-1 The dict API is too important to be burdened with a mostly useless and 
rarely needed method.  Besides we already have simple ways to do it, for 
example:

assert list(d.items()) == list(e.items())

or:

assert OrderedDict(d) == OrderedDict(e)

--

___
Python tracker 

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



[issue45086] f-string unmatched ']'

2021-09-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The behavior remains the same in 3.11 ('main' branch).  New PEG parser parses 
this the same.

(Pablo, if there is a mistake below, please correct.)

Normally, the parser copies code chars between quotes, with or without '\' 
interpretation, into a string object.  When the 'f' prefix is given, the string 
gets divided into substrings and replacement fields.  The code part of each 
replacement field is separately parsed.  There are two options: 1. parse the 
field code while looking for an endcode marker; 2. look ahead for an endcode 
marker and then parse the code.

The current behavior is consistent with opotion 1 and the python policy of 
reporting the first error found and exiting, rather than trying to 
resynchronize to try to find more errors.

--
nosy: +pablogsal, terry.reedy
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
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



[issue45060] Do not use the equality operators with None

2021-09-03 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue45060] Do not use the equality operators with None

2021-09-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset e2b29304137e6253b7bb89c180ef5d113d60b4eb by Serhiy Storchaka in 
branch '3.10':
[3.10] bpo-45060: Get rid of few uses of the equality operators with None 
(GH-28087). (GH-28092)
https://github.com/python/cpython/commit/e2b29304137e6253b7bb89c180ef5d113d60b4eb


--
nosy: +terry.reedy

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-09-03 Thread Nick Coghlan


Nick Coghlan  added the comment:

For the module metadata problem: one potential approach to that for "designed 
to be frozen" stdlib modules is to set the values directly in the module code, 
rather than trying to set them automatically in the frozen import machinery.

It should also be possible to delete the implicitly created metadata fields and 
use module level dynamic attribute retrieval to find the stdlib source code for 
tracebacks and introspection purposes without incurring any start up costs.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue45058] Undefined behavior for syntax "except AError or BError:" accepted by interpreter

2021-09-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

"except a or b:" should be same as "except (a or b):" which should be same as 
"except a:", which is current behavior in 3.10.0, etc.

--
nosy: +terry.reedy
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



[issue36521] Consider removing docstrings from co_consts in code objects

2021-09-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

Let's wait until Mark Shannon is back from vacation (another week).

Note that class docstrings *are* contained in the class body code object -- 
there's executable code equivalent to

__doc__ = "this is the docstring"

But I agree it's not easily found without analyzing the bytecode.

Maybe the status quo is best after all? I would like to be able to identify 
code objects for functions, we could add a bit to co_flags for that.

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue36521] Consider removing docstrings from co_consts in code objects

2021-09-03 Thread Inada Naoki


Inada Naoki  added the comment:

> I am still not convinced that it's a good idea to put the docstring in the 
> surrounding code object. I'd like to be able to see it when I introspect a 
> code object, not just when introspecting a function object (I may be 
> analyzing code only, and it's hard to connect the code object with the 
> NEW_FUNCTION opcode in the parent code object -- you have to scan the 
> bytecode, which is fragile.)

I think that reasoning is not strong enough to add new member to code object.

* Modules and classes don't get docstring from their code objects. Why only 
functions need to store docstring?
* Lambdas, comprehensions, and PEP 649 (if acceptted) uses code objects but no 
docstring. Why they need to pay cost of `co_doc` member? (cost = memory + 
unmarshal time).

Code objects have filename and firstlineno. And there are many functions 
without docstring. So removing docstring from code object won't make inspection 
hard so much.

--

___
Python tracker 

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



[issue45056] compiler: Unnecessary None in co_consts

2021-09-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

Since we're not changing the magic number, wheels created for rc1 will still 
work with the final 3.10 (and vice versa!) -- creating a wheel or PYC file just 
will produce a different sequence of bytes, but there are other things that do 
that.

Then again, since we're not changing the magic number, it's not the end of the 
world to put off the backport to 3.10.1.

So I've convinced myself that it actually doesn't matter, and probably it's 
best to wait for 3.10.1 (changes to the compiler are always risky).

--

___
Python tracker 

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



[issue45093] Add method to compare dicts accounting for order

2021-09-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

-1 The dict API is to important to be burdened with a mostly useless and rarely 
needed method.  Besides we already have simple ways to do it, for example:

assert list(d.items()) == list(e.items())

or:

assert OrderedDict(d) == OrderedDict(e)

--
nosy: +rhettinger

___
Python tracker 

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



[issue45056] compiler: Unnecessary None in co_consts

2021-09-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I honestly want to backport it because I think it should not have any negative 
impact, but on the other hand I don't feel very confident as the release 
candidate phase is supposed to be as close as possible as the final release and 
this is not fixing a critical bug. The devguide says about the RC:


>>Generally, these issues must be severe enough (e.g. crashes) that they 
>>deserve fixing before the final release. All other issues should be deferred 
>>to the next development cycle, since stability is the strongest concern at 
>>this point.

I am just trying to be cautious but on the other hand we still have anltbet 
release candidate for people to try it out before the final release so if you 
all think is better to have this on the RC and this is not going to be an issue 
for existing universal wheels and the like, then I suppose we can merge it 
before Rc2

--

___
Python tracker 

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



[issue45034] Improve struct.pack out of range error messages

2021-09-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I agree, including use of hex, if possible, for unsigned (non-negative) values.

Grepping 'format requires' returns
F:\dev\3x\Modules\_struct.c: 365: "'%c' format requires 0 <= number 
<= %zu",
F:\dev\3x\Modules\_struct.c: 371: "'%c' format requires %zd <= 
number <= %zd",
F:\dev\3x\Modules\_struct.c: 550: "byte format requires 
-128 <= number <= 127");
F:\dev\3x\Modules\_struct.c: 565: "ubyte format 
requires 0 <= number <= 255");
F:\dev\3x\Modules\_struct.c: 577: "char format requires 
a bytes object of length 1");
F:\dev\3x\Modules\_struct.c: 593: "short format 
requires " Py_STRINGIFY(SHRT_MIN)
F:\dev\3x\Modules\_struct.c: 611: "ushort format 
requires 0 <= number <= "
   
Py_STRINGIFY(USHRT_MAX));

I believe l365 is the source for the 2nd example.  AFAIK, 'zu' is not valid for 
either C printf or Python % formating.
Lines 611 and 612 are the source for the 1st example.  From comments before 
line 365, there can be issues with lefts shifts, but '0x', '0x_', 
and '0x___' could be hard-coded strings that would cover all 
'normal' systems.

Grepping "argument out of range" returns
F:\dev\3x\Modules\_struct.c: 168: "argument out of 
range");
F:\dev\3x\Modules\_struct.c: 192: "argument out of 
range");
F:\dev\3x\Modules\_struct.c: 215: "argument out of 
range");
F:\dev\3x\Modules\_struct.c: 238: "argument out of 
range");
F:\dev\3x\Modules\_struct.c: 261: "argument out of 
range");
F:\dev\3x\Modules\_struct.c: 284: "argument out of 
range");

It is nnclear to me without more reading why some codes lead to this less 
helpful message.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue20658] os.environ.clear() fails with empty keys (posix.unsetenv)

2021-09-03 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.11 -Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue25291] better Exception message for certain task termination scenario

2021-09-03 Thread Irit Katriel


Irit Katriel  added the comment:

This is doing something different now (on 3.11):

iritkatriel@Irits-MBP cpython % ./python.exe ttt.py
/Users/iritkatriel/src/cpython/ttt.py:5: DeprecationWarning: There is no 
current event loop
  loop = asyncio.get_event_loop()
i am task..

[here it hangs and I kill it with ctrl-C]

^CTraceback (most recent call last):
  File "/Users/iritkatriel/src/cpython/ttt.py", line 12, in 
loop.run_forever()
^^
  File "/Users/iritkatriel/src/cpython/Lib/asyncio/base_events.py", line 595, 
in run_forever
self._run_once()

  File "/Users/iritkatriel/src/cpython/Lib/asyncio/base_events.py", line 1841, 
in _run_once
event_list = self._selector.select(timeout)
 ^^
  File "/Users/iritkatriel/src/cpython/Lib/selectors.py", line 562, in select
kev_list = self._selector.control(None, max_ev, timeout)
   ^
KeyboardInterrupt
Task exception was never retrieved
future:  exception=RuntimeError('Task does not 
support set_exception operation')>
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython/ttt.py", line 8, in task
myself.set_exception(RuntimeError('something bad'))
^^^
RuntimeError: Task does not support set_exception operation

--
nosy: +iritkatriel

___
Python tracker 

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



[issue23354] Loading 2 GiLOC file which raises exception causes wrong traceback

2021-09-03 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue42130] AsyncIO's wait_for can hide cancellation in a rare race condition

2021-09-03 Thread Sam Bull


Change by Sam Bull :


--
nosy: +dreamsorcerer
nosy_count: 8.0 -> 9.0
pull_requests: +26587
pull_request: https://github.com/python/cpython/pull/28149

___
Python tracker 

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



[issue45075] confusion between frame and frame_summary in traceback module

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



[issue45075] confusion between frame and frame_summary in traceback module

2021-09-03 Thread Irit Katriel

Irit Katriel  added the comment:


New changeset 0b58e863df9970b290a4de90c67f9ac30c443817 by Irit Katriel in 
branch 'main':
bpo-45075: distinguish between frame and FrameSummary in traceback mo… 
(GH-28112)
https://github.com/python/cpython/commit/0b58e863df9970b290a4de90c67f9ac30c443817


--

___
Python tracker 

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



[issue45056] compiler: Unnecessary None in co_consts

2021-09-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

Are you sure? I know we're really close to the release, but I'd much rather
change the PYC format during the RC cycle than once we're doing bugfix
releases. I don't think we've ever changed the magic number between bugfix
releases. (I realize this doesn't change the magic number, but it's
probably also the first time we make a change that affects marshal output
without requiring changes in marshal input.

--

___
Python tracker 

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



[issue45053] MD5SumTests.test_checksum_fodder fails on Windows

2021-09-03 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Yes, it was encodings problem :)

This line solved it (here: 
https://github.com/python/cpython/blob/6f8bc464e006f672d1aeafbfd7c774a40215dab2/Tools/scripts/md5sum.py#L69):

```python
out.write('%s %s\n' % (m.hexdigest(), filename.encode(
sys.getfilesystemencoding(),
).decode(sys.stdout.encoding)))
```

> The simplest way to "fix" the test is using TESTFN_ASCII instead of TESTFN.

I haven't changed this, because right now it should work for non-ASCII symbols 
as well. I can even add an explicit ASCII test if needed.

Shouldn't https://github.com/python/cpython/pull/28060 be merge before I submit 
a new PR, so we can be sure that test now works? In the current state it will 
be just ignored.

--

___
Python tracker 

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



[issue45096] Update Tools/freeze to make use of Tools/scripts/freeze_modules.py?

2021-09-03 Thread Eric Snow


New submission from Eric Snow :

In bpo-45019 we added Tools/scripts/freeze_modules.py to improve how we manage 
which modules get frozen by default.  (We turned previously manual steps into 
automation of generated code.)  There is probably some overlap with what we do 
in Tools/freeze/freeze.py.  Is so, we should make changes for better re-use.

--
components: Demos and Tools
messages: 401015
nosy: eric.snow, lemburg
priority: normal
severity: normal
stage: needs patch
status: open
title: Update Tools/freeze to make use of Tools/scripts/freeze_modules.py?
type: behavior
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



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-09-03 Thread Brandt Bucher


Change by Brandt Bucher :


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

___
Python tracker 

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



[issue45093] Add method to compare dicts accounting for order

2021-09-03 Thread Michael Rans


Michael Rans  added the comment:

Thank you. Another case is in round trip processing of JSON or YML. Other cases 
are where you would prefer an OrderedDict over a dict. 

I think the method would help clarify things because it would make it obvious 
that it is for ordered comparisons while the existing == does not do that.

eg. something like:
d1.compare_ordered(d2)
or:
d1.compare(d2, ordered=True)  # ordered could be by default True

--

___
Python tracker 

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



[issue45022] Update libffi to 3.4.2

2021-09-03 Thread Steve Dower


Steve Dower  added the comment:

So on one hand, this change applies cleanly and it appears nothing needs to 
change to adopt the newer version.

On the other hand, because the libffi DLL has a different name, it changes the 
layout on disk. I know we don't do that (except in exceptional circumstances) 
after beta, but perhaps this one is safe enough? We certainly don't "support" 
directly accessing the libffi DLL, but it still could break users (if, for 
example, they load another native module that implicitly used the older libffi 
and would now fail to load when it's missing).

Any thoughts?

--
stage: patch review -> backport needed

___
Python tracker 

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



[issue45022] Update libffi to 3.4.2

2021-09-03 Thread Steve Dower


Steve Dower  added the comment:


New changeset 6f8bc464e006f672d1aeafbfd7c774a40215dab2 by Steve Dower in branch 
'main':
bpo-45022: Update libffi to 3.4.2 in Windows build (GH-28146)
https://github.com/python/cpython/commit/6f8bc464e006f672d1aeafbfd7c774a40215dab2


--

___
Python tracker 

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



[issue12499] textwrap.wrap: add control for fonts with different character widths

2021-09-03 Thread Éric Araujo

Éric Araujo  added the comment:

A PR was opened for this.  `text_len` is used as param/attribute name.

--
versions: +Python 3.11 -Python 3.5

___
Python tracker 

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



[issue42255] webbrowser.MacOSX is unused, untested and undocumented

2021-09-03 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks for the patches, 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



[issue42255] webbrowser.MacOSX is unused, untested and undocumented

2021-09-03 Thread Łukasz Langa

Change by Łukasz Langa :


--
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue42255] webbrowser.MacOSX is unused, untested and undocumented

2021-09-03 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 2a8956c268772fd31aeeb6ee522f123af94a2926 by Dong-hee Na in branch 
'3.10':
bpo-42255: Update webbrowser doc for macOS (GH-28144)
https://github.com/python/cpython/commit/2a8956c268772fd31aeeb6ee522f123af94a2926


--

___
Python tracker 

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



[issue42255] webbrowser.MacOSX is unused, untested and undocumented

2021-09-03 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset ce83e42437b8e5a4bf4237f981a7a90401922456 by Dong-hee Na in branch 
'3.9':
bpo-42255: Update webbrowser doc for macOS (GH-28145)
https://github.com/python/cpython/commit/ce83e42437b8e5a4bf4237f981a7a90401922456


--

___
Python tracker 

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



[issue45056] compiler: Unnecessary None in co_consts

2021-09-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Let's wait for 3.10.1 to backport this because I prefer to keep pyc files 
stable for the release candidate. Turns out that people are already preparing 
wheels to 3.10 and although this may be fine, I don't want to risk 
incompatibilities for the release.

--

___
Python tracker 

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



[issue33618] Support TLS 1.3

2021-09-03 Thread Philip Prindeville


Change by Philip Prindeville :


--
nosy: +philipp

___
Python tracker 

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



[issue45022] Update libffi to 3.4.2

2021-09-03 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +26585
pull_request: https://github.com/python/cpython/pull/28146

___
Python tracker 

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



[issue43669] PEP 644: Require OpenSSL 1.1.1 or newer

2021-09-03 Thread Philip Prindeville


Change by Philip Prindeville :


--
nosy: +philipp

___
Python tracker 

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



[issue45095] Easier loggers traversal tree with a logger.getChildren method

2021-09-03 Thread Stéphane Blondon

New submission from Stéphane Blondon :

Currently, logging.root.manager.loggerDict is usable to do a homemade traversal 
of the loggers tree. However, it's not a public interface. Adding a 
'logger.getChildren()' method would help to implement the traversal. The method 
would return a set of loggers.


Usage example:
>>> import logging
>>> logging.basicConfig(level=logging.CRITICAL)
>>> root_logger = logging.getLogger()

>>> root_logger.getChildren()
set()
>>> a_logger = logging.getLogger("a")
>>> root_logger.getChildren()
{}
>>> logging.getLogger('a.b').setLevel(logging.DEBUG)
>>> _ = logging.getLogger('a.c')
>>> a_logger.getChildren()
{, }


With such method, traverse the tree will be obvious to write with a recursive 
function.


Use cases:
 - to check all the loggers are setted up correctly. I wrote a small function 
to get all loggers, and log on every level to check the real behaviour.
 - to draw the loggers tree like logging_tree library 
(https://pypi.org/project/logging_tree/). I didn't ask to logging_tree's 
maintainer but I don't think he would use such function because the library 
works for huge range of python releases.


I plan to write a PR if someone thinks it's a good idea.

--
components: Library (Lib)
messages: 401006
nosy: sblondon
priority: normal
severity: normal
status: open
title: Easier loggers traversal tree with a logger.getChildren method
type: enhancement
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



[issue45083] Need to use the exception class qualname when rendering exception (in C code)

2021-09-03 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 41c23740243cc3a0699bc4d5dcfd47a0007ff039 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-45083: Include the exception class qualname when formatting an 
exception (GH-28119) (GH-28135)
https://github.com/python/cpython/commit/41c23740243cc3a0699bc4d5dcfd47a0007ff039


--

___
Python tracker 

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



[issue45022] Update libffi to 3.4.2

2021-09-03 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 8c3a10e58b12608c3759fee684e7aa399facae2a by Steve Dower in branch 
'3.8':
bpo-45022: Pin current libffi build to fixed version in preparation for 
upcoming update (GH-27982) (GH-28001)
https://github.com/python/cpython/commit/8c3a10e58b12608c3759fee684e7aa399facae2a


--

___
Python tracker 

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



[issue42255] webbrowser.MacOSX is unused, untested and undocumented

2021-09-03 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +26584
pull_request: https://github.com/python/cpython/pull/28145

___
Python tracker 

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



[issue36521] Consider removing docstrings from co_consts in code objects

2021-09-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

I am still not convinced that it's a good idea to put the docstring in the 
surrounding code object. I'd like to be able to see it when I introspect a code 
object, not just when introspecting a function object (I may be analyzing code 
only, and it's hard to connect the code object with the NEW_FUNCTION opcode in 
the parent code object -- you have to scan the bytecode, which is fragile.)

--

___
Python tracker 

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



[issue42255] webbrowser.MacOSX is unused, untested and undocumented

2021-09-03 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +26583
pull_request: https://github.com/python/cpython/pull/28144

___
Python tracker 

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



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-09-03 Thread Brandt Bucher


Brandt Bucher  added the comment:

Found it. This particular build is configured with HAVE_ALIGNED_REQUIRED=1, 
which forces it to use fnv instead siphash24 as its string hashing algorithm.

--

___
Python tracker 

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



[issue42255] webbrowser.MacOSX is unused, untested and undocumented

2021-09-03 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset bc1c49fa94b2abf70e6937373bf1e6b5378035c5 by Dong-hee Na in branch 
'main':
bpo-42255: Deprecate webbrowser.MacOSX from Python 3.11 (GH-27837)
https://github.com/python/cpython/commit/bc1c49fa94b2abf70e6937373bf1e6b5378035c5


--

___
Python tracker 

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



[issue1514420] Traceback display code can attempt to open a file named ""

2021-09-03 Thread Irit Katriel


Change by Irit Katriel :


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



[issue1514420] Traceback display code can attempt to open a file named ""

2021-09-03 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-09-03 Thread Brandt Bucher


Brandt Bucher  added the comment:

I'm compiling Clang now to try to reproduce using a UBSan build (I'm on Ubuntu, 
though).

I'm not entirely familiar with how these sanitizer builds work... could the 
implication be that we're hitting undefined behavior at some point? Or is it 
just a red herring?

Note also that the "set([float('nan'), b'a', b'b', b'c', 'x', 'y', 'z'])" and 
"frozenset([float('nan'), b'a', b'b', b'c', 'x', 'y', 'z'])" tests seem to be 
working just fine... meaning their ordering on this buildbot is different under 
PYTHONHASHSEEDs 0 and 1 (as expected). It may still be a 
platform-or-configuration-dependent ordering, though.

Raymond: off the top of your head, are there any obvious reasons this could be 
happening?

--
assignee:  -> brandtbucher

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread Dong-hee Na


Dong-hee Na  added the comment:

I like the idea of Py_ALWAYS_INLINE personally if we have to do that.

--

___
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-09-03 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset 85ea2d6165dec0cffa6302eb6dc40406eae1edf5 by Batuhan Taskaya in 
branch 'main':
bpo-43950: support positions for dis.Instructions created through dis.Bytecode 
(GH-28142)
https://github.com/python/cpython/commit/85ea2d6165dec0cffa6302eb6dc40406eae1edf5


--

___
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-09-03 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
pull_requests: +26581
pull_request: https://github.com/python/cpython/pull/28142

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +26580
pull_request: https://github.com/python/cpython/pull/28141

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7974c30b9fd84fa56ea1515ed2c08b38edf1a383 by Victor Stinner in 
branch 'main':
bpo-45094: Add Py_NO_INLINE macro (GH-28140)
https://github.com/python/cpython/commit/7974c30b9fd84fa56ea1515ed2c08b38edf1a383


--

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7974c30b9fd84fa56ea1515ed2c08b38edf1a383 by Victor Stinner in 
branch 'main':
bpo-45094: Add Py_NO_INLINE macro (GH-28140)
https://github.com/python/cpython/commit/7974c30b9fd84fa56ea1515ed2c08b38edf1a383


--

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7974c30b9fd84fa56ea1515ed2c08b38edf1a383 by Victor Stinner in 
branch 'main':
bpo-45094: Add Py_NO_INLINE macro (GH-28140)
https://github.com/python/cpython/commit/7974c30b9fd84fa56ea1515ed2c08b38edf1a383


--

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7974c30b9fd84fa56ea1515ed2c08b38edf1a383 by Victor Stinner in 
branch 'main':
bpo-45094: Add Py_NO_INLINE macro (GH-28140)
https://github.com/python/cpython/commit/7974c30b9fd84fa56ea1515ed2c08b38edf1a383


--

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-09-03 Thread Brandt Bucher

Brandt Bucher  added the comment:

Thanks for finding this, Victor.

That failure is surprising to me. Is it really possible for the order of the 
elements in a set to vary based on platform or build configuration (even with a 
fixed PYTHONHASHSEED at runtime)?

Really, this looks like it’s only a bug in the test’s (read “my”) assumptions, 
not really in marshal itself. I’m glad I added this little sanity check, though.

--

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread Ken Jin


Change by Ken Jin :


--
nosy: +kj

___
Python tracker 

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



[issue44348] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds

2021-09-03 Thread STINNER Victor


STINNER Victor  added the comment:

See bpo-45094: "Consider using __forceinline and __attribute__((always_inline)) 
on static inline functions (Py_INCREF, Py_TYPE) for debug builds".

--

___
Python tracker 

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



[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2021-09-03 Thread STINNER Victor


STINNER Victor  added the comment:

See bpo-45094: "Consider using __forceinline and __attribute__((always_inline)) 
on static inline functions (Py_INCREF, Py_TYPE) for debug builds".

--

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +corona10, erlendaasland, pablogsal

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread STINNER Victor


Change by STINNER Victor :


--
title: Consider using __forceinline and __attribute__((always_inline)) for 
debug builds -> Consider using __forceinline and __attribute__((always_inline)) 
on static inline functions (Py_INCREF, Py_TYPE) for debug builds

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) for debug builds

2021-09-03 Thread STINNER Victor


New submission from STINNER Victor :

I converted many C macros to static inline functions to reduce the risk of 
programming bugs (macros pitfalls), limit variable scopes to the function, have 
a more readable function, and benefit of the function name even when it's 
inlined in debuggers and profilers.

When Py_INCREF() macro was converted to a static inline function, using 
__attribute__((always_inline)) was considered, but the idea was rejected. See 
bpo-35059.

I'm now trying to convert the Py_TYPE() macro to a static inline function. The 
problem is that by default, MSC disables inlining and test_exceptions does 
crash with a stack overflow, since my PR 28128 increases the usage of the stack 
memory: see bpo-44348.

For the specific case of CPython built by MSC, we can increase the stack size, 
or change compiler optimizations to enable inlining. But the problem is wider 
than just CPython built by MSC in debug mode. Third party C extensions built by 
distutils may get the same issue. Building CPython on other platforms on debug 
mode with all compiler optimizations disabled (ex: gcc -O0) can also have the 
same issue.

I propose to reconsider the usage __forceinline (MSC) and 
__attribute__((always_inline)) (GCC, clang) on the most important static inline 
functions, like Py_INCREF() and Py_TYPE(), to avoid this issue.

--
components: Interpreter Core
messages: 400990
nosy: vstinner
priority: normal
severity: normal
status: open
title: Consider using __forceinline and __attribute__((always_inline)) for 
debug builds
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



[issue41031] Inconsistency in C and python traceback printers

2021-09-03 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +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



[issue41031] Inconsistency in C and python traceback printers

2021-09-03 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 1.0 -> 2.0
pull_requests: +26578
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28139

___
Python tracker 

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



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-09-03 Thread STINNER Victor


STINNER Victor  added the comment:

The test failed at:

def test_deterministic_sets(self):
# bpo-37596: To support reproducible builds, sets and frozensets need to
# have their elements serialized in a consistent order (even when they
# have been scrambled by hash randomization):
for kind in ("set", "frozenset"):
for elements in (
"float('nan'), b'a', b'b', b'c', 'x', 'y', 'z'",
# Also test for bad interactions with backreferencing:
"('string', 1), ('string', 2), ('string', 3)",
):
s = f"{kind}([{elements}])"
with self.subTest(s):
# First, make sure that our test case still has different
# orders under hash seeds 0 and 1. If this check fails, we
# need to update this test with different elements:
args = ["-c", f"print({s})"]
_, repr_0, _ = assert_python_ok(*args, PYTHONHASHSEED="0")
_, repr_1, _ = assert_python_ok(*args, PYTHONHASHSEED="1")
self.assertNotEqual(repr_0, repr_1)  # <=== HERE
(...)

It checks that the representation of a set is different for two different 
PYTHONHASHSEED values (0 and 1). On my Fedora 34, I confirm that they are 
different:

PYTHONHASHSEED=0:

vstinner@apu$ PYTHONHASHSEED=0 ./python -c "print(set([('string', 1), 
('string', 2), ('string', 3)]))"
{('string', 1), ('string', 2), ('string', 3)}
vstinner@apu$ PYTHONHASHSEED=0 ./python -c "print(set([('string', 1), 
('string', 2), ('string', 3)]))"
{('string', 1), ('string', 2), ('string', 3)}
vstinner@apu$ PYTHONHASHSEED=0 ./python -c "print(set([('string', 1), 
('string', 2), ('string', 3)]))"
{('string', 1), ('string', 2), ('string', 3)}

versus PYTHONHASHSEED=1:

vstinner@apu$ PYTHONHASHSEED=1 ./python -c "print(set([('string', 1), 
('string', 2), ('string', 3)]))"
{('string', 3), ('string', 1), ('string', 2)}
vstinner@apu$ PYTHONHASHSEED=1 ./python -c "print(set([('string', 1), 
('string', 2), ('string', 3)]))"
{('string', 3), ('string', 1), ('string', 2)}
vstinner@apu$ PYTHONHASHSEED=1 ./python -c "print(set([('string', 1), 
('string', 2), ('string', 3)]))"

--

___
Python tracker 

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



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-09-03 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue.

test_marshal failed on AMD64 Arch Linux Usan 3.x:
https://buildbot.python.org/all/#/builders/719/builds/108

==
FAIL: test_deterministic_sets (test.test_marshal.BugsTestCase) [set([('string', 
1), ('string', 2), ('string', 3)])]
--
Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/test/test_marshal.py",
 line 365, in test_deterministic_sets
self.assertNotEqual(repr_0, repr_1)
^^^
AssertionError: b"{('string', 1), ('string', 2), ('string', 3)}\n" == 
b"{('string', 1), ('string', 2), ('string', 3)}\n"

==
FAIL: test_deterministic_sets (test.test_marshal.BugsTestCase) 
[frozenset([('string', 1), ('string', 2), ('string', 3)])]
--
Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/test/test_marshal.py",
 line 365, in test_deterministic_sets
self.assertNotEqual(repr_0, repr_1)
^^^
AssertionError: b"frozenset({('string', 1), ('string', 2), ('string', 3)})\n" 
== b"frozenset({('string', 1), ('string', 2), ('string', 3)})\n"

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



[issue36521] Consider removing docstrings from co_consts in code objects

2021-09-03 Thread Inada Naoki


Change by Inada Naoki :


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

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


Change by Julien Palard :


--
pull_requests: +26576
pull_request: https://github.com/python/cpython/pull/28137

___
Python tracker 

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



[issue24665] CJK support for textwrap

2021-09-03 Thread Tobias Bengfort


Change by Tobias Bengfort :


--
nosy: +xi2
nosy_count: 10.0 -> 11.0
pull_requests: +26575
pull_request: https://github.com/python/cpython/pull/28136

___
Python tracker 

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



[issue12499] textwrap.wrap: add control for fonts with different character widths

2021-09-03 Thread Tobias Bengfort


Change by Tobias Bengfort :


--
pull_requests: +26574
pull_request: https://github.com/python/cpython/pull/28136

___
Python tracker 

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



[issue12499] textwrap.wrap: add control for fonts with different character widths

2021-09-03 Thread Tobias Bengfort


Change by Tobias Bengfort :


--
nosy: +xi2

___
Python tracker 

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



[issue45077] multiprocessing.Pool(64) crashes on Windows

2021-09-03 Thread Eryk Sun


Eryk Sun  added the comment:

See bpo-26903 for a similar problem in concurrent.futures.ProcessPoolExecutor. 
It was resolved by adding a limit constant, _MAX_WINDOWS_WORKERS == 61. 

WaitForMultipleObjects() can wait on up to 64 object handles, but in this case 
3 slots are already taken. The pool wait includes two events for its output and 
change-notifier queues (named pipes), plus the _winapi module always reserves a 
slot for the SIGINT event, even though this event is only used by waits on the 
main thread.

To avoid the need to limit the pool size, connection._exhaustive_wait() could 
be modified to combine simultaneous waits on up to 63 threads, for which each 
thread exhaustively populates a list of up to 64 signaled objects. I wouldn't 
want to modify _winapi.WaitForMultipleObjects, but the exhaustive wait should 
still be implemented in C, probably in the _multiprocessing extension module. A 
benefit of implementing _exhaustive_wait() in C is lightweight thread creation, 
directly with CreateThread() and a relatively small stack commit size.

--
components: +Library (Lib)
nosy: +eryksun
versions: +Python 3.10, Python 3.11

___
Python tracker 

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



[issue44748] argparse: a bool indicating if arg was encountered

2021-09-03 Thread wodny


wodny  added the comment:

I used a wrapper to default values. This gives me nice help message with 
ArgumentDefaultsHelpFormatter and easy way to update a config file dictionary 
with results from parse_args().

```python
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, Namespace
from dataclasses import dataclass
from typing import Any

@dataclass
class Default:
value: Any

def __str__(self):
return str(self.value)

@staticmethod
def remove_defaults(ns):
return Namespace(**{ k: v for k, v in ns.__dict__.items() if not 
isinstance(v, Default)})

@staticmethod
def strip_defaults(ns):
return Namespace(**{ k: v.value if isinstance(v, Default) else v for k, 
v in ns.__dict__.items() })

p = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
p.add_argument("--foo", "-f", default=Default(10), help="the foo arg")
p.add_argument("--bar", "-b", default=Default("big-bar"), help="the bar arg")
p.add_argument("--baz", "-z", default=True, help="the baz arg")
options = p.parse_args()
print(options)
print(Default.remove_defaults(options))
print(Default.strip_defaults(options))
```

```sh
$ ./arguments.py -b hello
Namespace(bar='hello', baz=True, foo=Default(value=10))
Namespace(bar='hello', baz=True)
Namespace(bar='hello', baz=True, foo=10)

$ ./arguments.py -b hello -h
usage: arguments.py [-h] [--foo FOO] [--bar BAR] [--baz BAZ]

optional arguments:
  -h, --help show this help message and exit
  --foo FOO, -f FOO  the foo arg (default: 10)
  --bar BAR, -b BAR  the bar arg (default: big-bar)
  --baz BAZ, -z BAZ  the baz arg (default: True)
```

--

___
Python tracker 

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



[issue43613] gzip.compress and gzip.decompress are sub-optimally implemented.

2021-09-03 Thread Ruben Vorderman


Ruben Vorderman  added the comment:

Issue was solved by moving code from _GzipReader to separate functions and 
maintaining the same error structure. 
This solved the problem with maximum code reuse and full backwards 
compatibility.

--

___
Python tracker 

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



[issue34602] python3 resource.setrlimit strange behaviour under macOS

2021-09-03 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset be9de8721d63b9d8e032d508069daf88c06542c6 by Łukasz Langa in 
branch 'main':
bpo-34602: Quadruple stack size on macOS when compiling with UBSAN (GH-27309)
https://github.com/python/cpython/commit/be9de8721d63b9d8e032d508069daf88c06542c6


--

___
Python tracker 

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



[issue45083] Need to use the exception class qualname when rendering exception (in C code)

2021-09-03 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +26572
pull_request: https://github.com/python/cpython/pull/28134

___
Python tracker 

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



[issue45083] Need to use the exception class qualname when rendering exception (in C code)

2021-09-03 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset b4b6342848ec0459182a992151099252434cc619 by Irit Katriel in 
branch 'main':
bpo-45083: Include the exception class qualname when formatting an exception 
(GH-28119)
https://github.com/python/cpython/commit/b4b6342848ec0459182a992151099252434cc619


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45083] Need to use the exception class qualname when rendering exception (in C code)

2021-09-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26573
pull_request: https://github.com/python/cpython/pull/28135

___
Python tracker 

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



[issue43613] gzip.compress and gzip.decompress are sub-optimally implemented.

2021-09-03 Thread Ruben Vorderman


Change by Ruben Vorderman :


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



[issue43612] zlib.compress should have a wbits argument

2021-09-03 Thread Ruben Vorderman


Ruben Vorderman  added the comment:

Thanks for the review, Lukasz! It was fun to create the PR and optimize the 
performance for gzip.py as well.

--

___
Python tracker 

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



[issue45090] Add pairwise to What's New in Python 3.10; mark it as new in itertools docs

2021-09-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +rhettinger
stage:  -> needs patch

___
Python tracker 

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



[issue37694] Crash when calling zipimport.zipimporter.__new__().()

2021-09-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Because the zipimport module is now implemented in Python.

--

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-03 Thread Łukasz Langa

Change by Łukasz Langa :


--
versions: +Python 3.10, Python 3.11

___
Python tracker 

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



[issue45093] Add method to compare dicts accounting for order

2021-09-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For tests it can be more convenient to use

list(d1.items()) == list(d2.items())

because it can produce better report on failure.

You can add a simple helper function if you use it multiple times in tests.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-03 Thread miss-islington


miss-islington  added the comment:


New changeset 79e9f5a58427c73dc546cb571819d50defe2e14f by Miss Islington (bot) 
in branch '3.10':
bpo-45081: Fix __init__ method generation when inheriting from Protocol 
(GH-28121)
https://github.com/python/cpython/commit/79e9f5a58427c73dc546cb571819d50defe2e14f


--

___
Python tracker 

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



[issue45092] Make set ordered like dict

2021-09-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Make set ordered

___
Python tracker 

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