[issue46386] Improve `test_typing::test_immutability_by_copy_and_pickle`

2022-01-15 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thank you @sobolevn !

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



[issue46386] Improve `test_typing::test_immutability_by_copy_and_pickle`

2022-01-15 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 09087b8519316608b85131ee7455b664c00c38d2 by Nikita Sobolev in 
branch 'main':
bpo-46386: improve `test_typing:test_immutability_by_copy_and_pickle` (GH-30613)
https://github.com/python/cpython/commit/09087b8519316608b85131ee7455b664c00c38d2


--
nosy: +corona10

___
Python tracker 

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



[issue46386] Improve `test_typing::test_immutability_by_copy_and_pickle`

2022-01-15 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Thank you, Jelle. Will send a PR to typing_extensions today as well :)

--

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-15 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset acf7403f9baea3ae1119fc6b4a3298522188bf96 by Ethan Furman in 
branch 'main':
bpo-40066:  [Enum] update str() and format() output (GH-30582)
https://github.com/python/cpython/commit/acf7403f9baea3ae1119fc6b4a3298522188bf96


--

___
Python tracker 

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



[issue46386] Improve `test_typing::test_immutability_by_copy_and_pickle`

2022-01-15 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

The additional tests would also be useful to have in 
https://github.com/python/typing/tree/master/typing_extensions if you're 
interested.

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-15 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

There's also the hacky expression {*()} to get an empty set

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Sigh.  You are right.  I will close this tomorrow.


This also means that 'set()' is not guaranteed to return an empty built-in set. 
I did think of this workaround for that:
>>> (empty:={None}).clear()
>>> empty
set()
 
Go ahead and propose something on python-ideas if you want, pointing out that 
only displays (and comprehensions) are guaranteed to result in a builtin.

--

___
Python tracker 

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



[issue46387] `test_field_descriptor` in `test_collections` should test all pickle protocols

2022-01-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I approved this but the code wasn't wrong.  Once an object has demonstrated 
that it can pickle at all, it is the testing responsibility of the pickle 
module tests to make sure that new protocols handle the same inputs as the old 
ones.

I went ahead and applied the PR because it is harmless, but it is a gratuitous 
test, so I don't recommend sweeping through all other pickling tests and 
modifying them in the same way.

--
assignee:  -> rhettinger
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



[issue46387] `test_field_descriptor` in `test_collections` should test all pickle protocols

2022-01-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 37eab55ac9da6b6361f136a1da15bfcef12ed954 by Nikita Sobolev in 
branch 'main':
bpo-46387: test all pickle protos in `test_field_descriptor` in 
`test_collections` (GH-30614)
https://github.com/python/cpython/commit/37eab55ac9da6b6361f136a1da15bfcef12ed954


--

___
Python tracker 

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



[issue43476] Enabling access to showsyntaxerror for IDLE's shell

2022-01-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Whatever you worked out is probably better than depending on something that I 
hope to significantly change.

--
resolution:  -> out of date
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



[issue45447] IDLE: Support syntax highlighting for .pyi stub files

2022-01-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

A minimal version of util.py just for this issue is fine.  What is blocking the 
issue deciding exactly what the minimum should be.  Are both the extension list 
and function needed?

Alex says somewhere in PR comments that ispythonsource passes directories.  
That seems wrong.  Perhaps moving and revising it and making no-extension files 
browsable and removing the x.py(?) limitation should be a separate issue.  IDLE 
users on *nix don't mind using extensions.  I have not seen a complaint, though 
perhaps people who do mind silently use something else.  I need to check again 
how the editor function is used and decide if we can leave it alone for now.  
So don't remove anything just now.

I need to experiment with Ron's suggestion on my Mac.

The Windows context menu is definitely a separate issue.

Please add idle_test/example.pyi with the line in msg403741 for manual testing 
now and possibly future automatic testing.

--

___
Python tracker 

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



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-15 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

The difficulty is that frozenset may have been shadowed, or builtins 
monkey-patched, so we cannot know what frozenset({1, 2, 3}) will return until 
runtime.

Should we re-consider a frozenset display literal?

f{1, 2, 3}

works for me.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue43371] Mock.assert_has_calls works strange

2022-01-15 Thread Roy Smith


Roy Smith  added the comment:

I agree that this is confusing and that what we need is an assertion for the 
top-level mock having specific calls in a specific order, and ignores any 
intervening extra calls to mocked functions.  In other words, a version of 
assert_has_calls() which looks at call_args_list instead of mock_calls.

I just finished up a session of head-banging with some tests that were failing 
(Python 3.7), and eventually ended up with the

self.assertEqual(my_mock.call_args_list, [call(...), call(...)])

idiom as noted in msg397172 (but without first banging a few new dents into the 
top of my desk).  This exact same experience is related in a recent 
stackoverflow thread 
(https://stackoverflow.com/questions/69360318/python-unittest-mock-assert-has-calls-returning-calls-to-other-mocks)
 so this seems to be a common source of confusion.

I am neutral on whether this is implemented as a new flag to assert_has_calls() 
or as a new assertion method.

As an aside, what I was trying to do was test if my code constructed its 
several instances of a class in the correct way.  At one point I hit upon the 
idea of:

MyMockedClass().__init__.assert_has_calls()

which expressed my desired logic exactly and simply, but couldn't get that to 
work.  It's unclear if I just never found the proper incantation, or if that's 
fundamentally unworkable.

--
nosy: +roysmith

___
Python tracker 

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



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-15 Thread Terry J. Reedy


New submission from Terry J. Reedy :

The CPython compiler is capable of making frozenset constants without being 
explicitly asked to.  Exactly how it does so is, of course, 'hidden' from 
python code.  With current main:
.
>>> dis('{1,2,3}')
  1   0 BUILD_SET0
  2 LOAD_CONST   0 (frozenset({1, 2, 3}))
  4 SET_UPDATE   1
  6 RETURN_VALUE

Suppose one wants actually wants a frozenset, not a mutable set.  
'frozenset({1,2,3})' is compiled as the above followed by a frozenset call -- 
making an unneeded double conversion to get what already exists. 
To avoid the intermediate set, one can use a constant tuple instead.

>>> dis('frozenset((1,2,3))')
  1   0 LOAD_NAME0 (frozenset)
  2 LOAD_CONST   0 ((1, 2, 3))
  4 CALL_FUNCTION1
  6 RETURN_VALUE

Even nicer would be

  1   0 (frozenset({1, 2, 3}))
  2 RETURN_VALUE

'set((1,2,3))' is compiled the same as 'frozenset((1,2,3)), but frozenset does 
not having the option is using a more efficient display form.  I cannot think 
of any reason to not call frozenset during compile time when the iterable is a 
constant tuple.

Serhiy, I not sure how this relates to your issue 33318 and the discussion 
therein about stages, but it does relate to your interest in compile time 
constants.

--
components: Interpreter Core
messages: 410666
nosy: serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: Generate frozenset constants when explicitly appropriate
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



[issue46392] MessageIDHeader is too strict for message-id

2022-01-15 Thread bpoaugust


New submission from bpoaugust :

The email headerregistry class MessageIDHeader is too strict when parsing 
existing Message-Ids. It can truncate Message-Ids that are valid according to 
the obsolete rules.

As the saying has it: 
"Be liberal in what you accept, and conservative in what you send."

I think the parser should be much closer to the UnstructuredHeader.

--
components: email
messages: 410665
nosy: barry, bpoaugust, r.david.murray
priority: normal
severity: normal
status: open
title: MessageIDHeader is too strict for message-id

___
Python tracker 

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



[issue39663] IDLE: Add additional tests for pyparse

2022-01-15 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
type:  -> enhancement

___
Python tracker 

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



[issue46388] Improve test coverage of functools.total_ordering

2022-01-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the PR.

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



[issue46388] Improve test coverage of functools.total_ordering

2022-01-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 0a28118324f64851b684ec3afdd063c47513a236 by Russel Webber in 
branch 'main':
bpo-46388: Test NotImplemented code path for functools.total_ordering (GH-30616)
https://github.com/python/cpython/commit/0a28118324f64851b684ec3afdd063c47513a236


--

___
Python tracker 

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



[issue46372] int/float specializations should mutate the LHS in-place when possible

2022-01-15 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +vstinner

___
Python tracker 

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



[issue39986] test_os / test_listdir failed as root-directory changed during test

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46378] Experiment with LLVM BOLT binary optimizer

2022-01-15 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue42548] debugger stops at breakpoint of `pass` that is not actually reached

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

I can't reproduce this on 3.11.

3.7 is no longer maintained, and there have been many changes since then to the 
trace output. It is likely that this bug has been fixed, but please create a 
new issue if you see it on a current version.

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue34672] '%Z' strftime specifier never works with musl

2022-01-15 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



[issue36369] test_weakref super slow on RPi Zero

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

3.7 is no longer maintained. Please create a new issue if you are seeing slow 
tests with a current version of python (ideally 3.10 or one of the 3.11 
alphas), and you are interested in investigating along the lines of Victor's 
suggestion.

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue42390] Other Python implementations may not expose the module name in datetime type names

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

William, can you elaborate where this came up?

--
nosy: +iritkatriel
status: open -> pending
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue39276] type() cause segmentation fault in callback function called from C extension

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue34924] inspect.signature isn't aware that types.MethodType can wrap any callable

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue37084] _ctypes not failing, can't find reason

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

Python 3.7 is no longer maintained, so it's unlikely anyone will look at this 
now. Please create a new issue if you can reproduce the problem on a current 
version (>=3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue44901] Info about used pickle protocol used by multiprocessing.Queue

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue23557] Misc/SpecialBuilds.txt contains outdated information about PYMALLOC_DEBUG

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

The PYMALLOC_DEBUG macro was removed in 
https://github.com/python/cpython/pull/25711/files

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue46391] Library multiprocess leaks named resources.

2022-01-15 Thread Oleg Iarygin


Oleg Iarygin  added the comment:

I added core devs related to multiprocessing into a nosy list so they got a 
notification and the PR will be evaluated and merged faster. FYI, the devs are 
Davin Potts and Antoine Pitrou (as per ).

--
nosy: +arhadthedev, davin, pitrou

___
Python tracker 

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



[issue29257] Possible error in discussion of Abstract Base Classes and abstract properties

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

I think this is out of date, the example is different now:

https://docs.python.org/3/library/abc.html#abc.abstractproperty

--
nosy: +iritkatriel
resolution:  -> out of date
status: open -> pending

___
Python tracker 

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



[issue40962] Add documentation for asyncio._set_running_loop()

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
type:  -> enhancement
versions: +Python 3.11 -Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue42199] bytecode_helper assertNotInBytecode fails too eagerly

2022-01-15 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



[issue39663] IDLE: Add additional tests for pyparse

2022-01-15 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



[issue39324] Add mimetype for extension .md (markdown)

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue43814] Fix the error message for disallowed __weakref__ slots

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue44408] imaplib fails when server sends extra blank line after literal value

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

How does it fail? Can you provide a reproducer and add a unit test to the PR?

--
nosy: +iritkatriel
type: crash -> behavior
versions:  -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



[issue46391] Library multiprocess leaks named resources.

2022-01-15 Thread XD Trol


Change by XD Trol :


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

___
Python tracker 

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



[issue28186] Autogenerated tabs / trailing whitespace

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> out of date
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



[issue46391] Library multiprocess leaks named resources.

2022-01-15 Thread XD Trol


New submission from XD Trol :

Repo is the standard tool that Google uses to build Android, Chrome OS, 
Chromium, etc, written in Python. 

Many Repo users have encountered resource leak warnings with Python 3.9. 
https://bugs.chromium.org/p/gerrit/issues/detail?id=14934=component%3Arepo=5

I did some work and found that the problem is not caused by the code of Repo, 
but a bug of the Python library, multiprocess.

To make it simple, the Python script below leaks named resource even when 
exiting normally. (And be unlinked by resource_tracker with a warning. )

```
import multiprocessing as mp

global_resource = mp.Semaphore()

def submain(): pass

if __name__ == '__main__':
p = mp.Process(target=submain)
p.start()
p.join()
```

Tested on macOS with Python 3.9.7
> python test.py
resource_tracker: There appear to be 1 leaked semaphore objects to clean up at 
shutdown.

This bug will 100% reproduce when then main module uses named resources as 
global variables and uses `spawn` context, which is the case of Repo on macOS.

This is caused by multiprocess::BaseProcess::_bootstrap.

When a new process is started with multiprocessing.Process.start() in `spawn` 
context.
1. The main module is reloaded in the subprocess (for pickle) in 
multiprocessing::spawn::_main.
2. Named resources (such as the semaphore above) in the main module resister 
their _cleanup into multiprocessing::util::_finalizer_registry, which unlink 
themselves.
3. multiprocess::BaseProcess::_bootstrap then clears _finalizer_registry.

When a subprocess is spawned, it is no need to clear util::_finalizer_registry 
(and no need to call util::_run_after_forkers). Disable clearing 
_finalizer_registry (and disable call to _run_after_forkers) should fix this 
bug without breaking anything else.

And I uploaded a MR.

--
components: Library (Lib)
messages: 410654
nosy: milestonejxd
priority: normal
severity: normal
status: open
title: Library multiprocess leaks named resources.
type: resource usage
versions: Python 3.9

___
Python tracker 

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



[issue34165] uu.decode() raises binascii.Error instead of uu.Error on invalid data

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.7

___
Python tracker 

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



[issue39441] mimetypes.guess_extension unable to get non-lowercase mimetype

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

See also Issue20392.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue42028] Regression in mimetypes for image/bmp

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue37943] mimetypes.guess_extension() doesn’t get JPG right

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue39441] mimetypes.guess_extension unable to get non-lowercase mimetype

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue39823] Disassembly - improve documentation for bytecode instruction class and set source line no. attribute for every instruction

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

I don't think this change should be made - it would generate the same 
information in a slightly different format, which will break existing code 
while not making it possible to do anything we can't do now.

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.7

___
Python tracker 

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



[issue39819] NULL pointer crash in Modules/_cursesmodule.c in PyInit__curses() on MIPS uclibc-ng and ncurses-6.2

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

Python 3.7 is no longer maintained. Please create a new issue if you are seeing 
this problem on a current (>= 3.9) version.

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue44620] UUIDv1 is not RFC 4122 compliant

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
type:  -> behavior
versions:  -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



[issue45955] Calling read() on HTTPError may cause KeyError in tempfile

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
type:  -> behavior
versions:  -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



[issue44158] Clarify documentation for redirected stdout/stderr when using subprocess in Linux

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy

___
Python tracker 

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



[issue44158] Clarify documentation for redirected stdout/stderr when using subprocess in Linux

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
versions: +Python 3.10, Python 3.11 -Python 3.7, Python 3.8

___
Python tracker 

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



[issue45266] subtype_clear can not be called from derived types

2022-01-15 Thread Irit Katriel


Irit Katriel  added the comment:

Victor, it's not clear to me whether this is a bug report or a "how do I do 
this" question, but in either case if you posted your code along with "I 
expected X but got Y", it would be easier to understand the issue.

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



[issue45639] Support modern image formats in MIME types

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue45686] ElementTree.Element.extend: bad error message when error occurs in generator

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue6686] xml.sax.xmlreader.XMLReader.getProperty (xml.sax.handler.property_xml_string) returns bytes

2022-01-15 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



[issue46317] Pathlib.rename isn't robust

2022-01-15 Thread Barney Gale


Barney Gale  added the comment:

Fair enough. Users who wanted to avoid copying file metadata would then do 
something like this, I suppose?

import pathlib
import shutil

path = pathlib.Path('foo')
path.move('bar', copy_function=shutil.copy)

I guess the downside here is that users would still need to `import shutil` to 
do this. But I see the utility of allowing any copy_function to be supplied!

--

___
Python tracker 

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



[issue46378] Experiment with LLVM BOLT binary optimizer

2022-01-15 Thread Dong-hee Na


Change by Dong-hee Na :


--
components: +Build

___
Python tracker 

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



[issue46388] Improve test coverage of functools.total_ordering

2022-01-15 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-15 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue46317] Pathlib.rename isn't robust

2022-01-15 Thread Oz Tiram


Oz Tiram  added the comment:

Thanks for the answer, it makes sense now. Yes, I would adopt this.
Allowing users to use `copy2` (or any other functio ...) using a keyword.

--

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-15 Thread Christian Heimes


Christian Heimes  added the comment:

A bunch of failing tests are related to bpo-46390. CPython's test suite does 
not pass with musl libc yet.

--
dependencies: +Multiple test failures on Alpine 3.15 / musl-1.2.2-r7

___
Python tracker 

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



[issue43112] SOABI on Linux does not distinguish between GNU libc and musl libc

2022-01-15 Thread Christian Heimes


Christian Heimes  added the comment:

I noticed that 9 test suites are failing on Alpine 3.15, see bpo-46390. Should 
we require a stable buildbot before we proclaim official support for Alpine?

--
dependencies: +Multiple test failures on Alpine 3.15 / musl-1.2.2-r7

___
Python tracker 

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



[issue46390] Multiple test failures on Alpine 3.15 / musl-1.2.2-r7

2022-01-15 Thread Christian Heimes


New submission from Christian Heimes :

I'm getting multiple test failures with latest Alpine 3.15 and musl-1.2.2-r7. 
Some test failures may be caused by wrong assumptions in our tests, some might 
be bugs in musl lib.c

9 tests failed:
test__locale test_c_locale_coercion test_cmd_line test_gdb
test_locale test_os test_posix test_re test_selectors

I have attached the output of

./python -m test -v test__locale test_c_locale_coercion test_cmd_line test_gdb 
test_locale test_os test_posix test_re test_selectors 2>&1 | tee 
alpine315-tests.txt

You can use my container to reproduce the test failures:

$ podman run --privileged -ti --rm -v $(pwd):/cpython:Z 
quay.io/tiran/cpythonbuild:alpine-3.15 /bin/sh
# /cmd.sh
# cd /cpython/builddep/alpine-3.15-x86_64/
# make test

--
components: Build, Tests
files: alpine315-tests.txt
messages: 410645
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Multiple test failures on Alpine 3.15 / musl-1.2.2-r7
type: behavior
versions: Python 3.11
Added file: https://bugs.python.org/file50562/alpine315-tests.txt

___
Python tracker 

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



[issue10202] ftplib doesn't check close status after sending file

2022-01-15 Thread mike mcleod


mike mcleod  added the comment:

Working.. should be able to create pull request soon. Note part of suggestions 
include using SIOCOUTQ, but this does not have an equivalent for windows. And 
as Murphy's law goes this is likely to be where the problem is!

--

___
Python tracker 

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



[issue46389] 3.11: unused generator comprehensions cause f_lineno==None

2022-01-15 Thread Ned Batchelder


New submission from Ned Batchelder :

In Python 3.11, unused generator comprehensions cause trace events with 
f_lineno set to None.

 %< -
import linecache, sys

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

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

(i for i in [1])
--

$ python3.10 /tmp/runbpo.py
3.10.2 (main, Jan 15 2022, 05:51:59) [Clang 12.0.0 (clang-1200.0.32.29)]
call 17  : (i for i in [1])
exce 17  : (i for i in [1])
retu 17  : (i for i in [1])

$ python3.11 /tmp/runbpo.py
3.11.0a4 (main, Jan 14 2022, 18:14:29) [Clang 12.0.0 (clang-1200.0.32.29)]
call None: 
exce None: 
retu None: 

--
components: Interpreter Core
keywords: 3.11regression
messages: 410643
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: 3.11: unused generator comprehensions cause f_lineno==None
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



[issue46382] dataclass(slots=True) does not account for slots in base classes

2022-01-15 Thread Arie Bovenberg


Arie Bovenberg  added the comment:

Spencer is correct.

The documentation even adds: "This renders the meaning of the program 
undefined."

It's clear it doesn't break anything users would often encounter (we would have 
heard about it), but it's still undefined behavior.

--

___
Python tracker 

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



[issue46388] Improve test coverage of functools.total_ordering

2022-01-15 Thread Russel Webber


Change by Russel Webber :


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

___
Python tracker 

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



[issue46382] dataclass(slots=True) does not account for slots in base classes

2022-01-15 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

___
Python tracker 

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



[issue46382] dataclass(slots=True) does not account for slots in base classes

2022-01-15 Thread Spencer Brown


Spencer Brown  added the comment:

Both will function, but class B will add its slots after A's, causing there to 
be an extra unused slot in the object that you can only access by directly 
using the A.a descriptor. So all slotted inheriting dataclasses cause the 
object to use more memory than necessary.

--
nosy: +Spencer Brown

___
Python tracker 

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



[issue46133] Feature request: allow mechanism for creator of exec-generated code to provide source to pdb

2022-01-15 Thread Spencer Brown


Spencer Brown  added the comment:

There is a solution to this: you can modify the linecache module's cache to add 
lines under a fake filename, which is the approach attrs takes here:
https://github.com/python-attrs/attrs/blob/9727008fd1e40bc55cdc6aee71e0f61553f33127/src/attr/_make.py#L347
However, there are several downsides. 
- That dict isn't documented or appears in __all__, so it's arguably private.
- The C implementation of traceback printing opens files directly, so this 
doesn't work there.
- You have to invent a unique filename, and manually remove lines from the 
cache if the function is later deleted.
This does affect both namedtuple and dataclasses, though it's probably not too 
important given how straightforward the generated code they produce is.

--
nosy: +Spencer Brown

___
Python tracker 

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



[issue46388] Improve test coverage of functools.total_ordering

2022-01-15 Thread Russel Webber


New submission from Russel Webber :

A few lines of the functools.total_ordering implementation are not covered by 
the tests.

Specifically, coverage.py shows the returns of NotImplemented:
...
if op_result is NotImplemented:
return op_result 
...

as not covered in the functions: _gt_from_lt, _ge_from_le, _lt_from_le, 
_lt_from_gt, _le_from_ge and _gt_from_ge

I have a PR for this.

--
components: Tests
messages: 410639
nosy: RusselWebber, rhettinger
priority: normal
severity: normal
status: open
title: Improve test coverage of functools.total_ordering
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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-15 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28818
pull_request: https://github.com/python/cpython/pull/30615

___
Python tracker 

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



[issue46387] `test_field_descriptor` in `test_collections` should test all pickle protocols

2022-01-15 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46387] `test_field_descriptor` in `test_collections` should test all pickle protocols

2022-01-15 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +rhettinger

___
Python tracker 

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



[issue46387] `test_field_descriptor` in `test_collections` should test all pickle protocols

2022-01-15 Thread Nikita Sobolev


New submission from Nikita Sobolev :

Right now this test does not test all pickle protocols: 
https://github.com/python/cpython/blob/d02c5e9b55a8651b7d396ac3f2bdedf1fc1780b5/Lib/test/test_collections.py#L680-L682

But, I guess that it should, like all other tests do.
PR is on its way.

--
components: Tests
messages: 410638
nosy: sobolevn
priority: normal
severity: normal
status: open
title: `test_field_descriptor` in `test_collections` should test all pickle 
protocols
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



[issue46386] Improve `test_typing::test_immutability_by_copy_and_pickle`

2022-01-15 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46386] Improve `test_typing::test_immutability_by_copy_and_pickle`

2022-01-15 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +gvanrossum, kj

___
Python tracker 

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



[issue45447] IDLE: Support syntax highlighting for .pyi stub files

2022-01-15 Thread Alex Waygood


Alex Waygood  added the comment:

@terry, have you had a chance to glance at my PR at all? I'd really appreciate 
your review! :)

--

___
Python tracker 

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



[issue46386] Improve `test_typing::test_immutability_by_copy_and_pickle`

2022-01-15 Thread Nikita Sobolev


New submission from Nikita Sobolev :

There are several problems with this test: 
https://github.com/python/cpython/blob/d02c5e9b55a8651b7d396ac3f2bdedf1fc1780b5/Lib/test/test_typing.py#L2130
1. It does not test all `pickle` protocols
2. It does not test newly added `ParamSpec` (probably others, I will double 
check)
3. It does not clean up `global TP, TPB, TPV`

I will send a PR for this :)

--
components: Tests
messages: 410636
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Improve `test_typing::test_immutability_by_copy_and_pickle`
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



[issue46258] Minor algorithmic improvements for math.isqrt

2022-01-15 Thread Mark Dickinson


Change by Mark Dickinson :


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



[issue46258] Minor algorithmic improvements for math.isqrt

2022-01-15 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset d02c5e9b55a8651b7d396ac3f2bdedf1fc1780b5 by Mark Dickinson in 
branch 'main':
bpo-46258: Streamline isqrt fast path (#30333)
https://github.com/python/cpython/commit/d02c5e9b55a8651b7d396ac3f2bdedf1fc1780b5


--

___
Python tracker 

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



[issue6686] xml.sax.xmlreader.XMLReader.getProperty (xml.sax.handler.property_xml_string) returns bytes

2022-01-15 Thread Yassir Karroum


Change by Yassir Karroum :


--
nosy: +ukarroum
nosy_count: 7.0 -> 8.0
pull_requests: +28814
pull_request: https://github.com/python/cpython/pull/30612

___
Python tracker 

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



[issue43741] http.client leaks from self.fp.read()

2022-01-15 Thread Yassir Karroum


Yassir Karroum  added the comment:

Hi Hynkek,

Thanks for the bug report.

I'll change the type category to "resource usage", since "crash" is typically 
reserved for issues where python crash (for exemple due to a seg fault).

Can you also provide a minimal code to check your issue ? Where ideally all the 
parameters are fixed (as the url).

--
nosy: +ukarroum
type: crash -> resource usage

___
Python tracker 

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



[issue46383] _zoneinfo module_free has invalid function signature

2022-01-15 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303
nosy_count: 3.0 -> 4.0
pull_requests: +28813
pull_request: https://github.com/python/cpython/pull/30611

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-15 Thread Bar Harel


Bar Harel  added the comment:

> That was true in 2011 and it is still true today

Python's methodology greatly shifted since 2011. For the better or worse, 
Python lost some of its duck typing. Nowadays, most people use linters. 
Wherever you'd try to pass sre_parse.SubPattern, the linter will throw an error 
saying it's not a Sequence even if it fully behaves like one. You can silence 
that error but you'll continue receiving such warnings all over the code, 
whether in stdlib or out in the wild. The meaning of Sequence now shifted to 
"inherits from abc.Sequence". The only thing wrong with PySequence_Check is 
that the ecosystem shifted, but its view of a Sequence remained the same.

--

___
Python tracker 

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



[issue20281] [doc] time.strftime %z format specifier is the same as %Z

2022-01-15 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



[issue29964] [doc] %z directive has no effect on the output of time.strptime

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
resolution: works for me -> 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



[issue46376] PyMapping_Check returns 1 for list

2022-01-15 Thread Bar Harel


Bar Harel  added the comment:

@rhettinger I completely understand what you're saying and at first I agreed 
with you. Before I gave it a closer look, I thought about the same thing - we 
want reliability. Reliability is important and will avoid subtle bugs, which is 
why I was against this change for the exact reasons you mentioned: it is both 
breaking and unreliable.

I then realized that this change can be a reliable replacement for 
isinstance(obj, collections.abc.Sequence) at the C level. Let's use the broken 
sre_parse.SubPattern as an example - it does not register or inherit from 
collections.abc.Sequence, and isinstance(SubPattern, collections.abc.Sequence) 
== False. We cannot know programmatically if SubPattern is a Sequence, we 
cannot type hint it as such, and apart from reading the documentation, we 
cannot deal with the type differently in dynamic code that accepts either 
sequences or mappings. I dare to say, counting on it being a sequence, 
especially on a LBYL language like C is even less reliable. While SubPattern 
"embraces" the spirit of duck typing, it is very hard to fit in light of all 
recent changes advocating for a more structured and well defined types. After 
all, this feature was requested in order to solve reliability issues in 
statically typed languages.

Putting everything aside, the grand question still remains: do you think that 
there's a use for an efficient C-API isinstance check for Sequences and 
Mappings? I would presume the answer is yes. Would we encourage it? I have no 
clue. But if there's a need, we can either change this function as it has the 
same "spirit" or introduce a new one to prevent breaking existing code.

To answer your question: per specification, testing for Py_TPFLAGS_SEQUENCE 
using PyType_HasFeature, does not take strings, bytes and bytearray into 
consideration, and will not suffice. It is an incorrect solution that is even 
less reliable and falls into the exact pitfall of "guesswork" (for example 
SubPattern currently doesn't work with it either). It is not encouraged or 
easily thought of. PySequence_Check which is much more intuitive yet doesn't 
work either and that's where fixing it can have an edge.

A theoretical `PyIsInstance_Sequence` can check for TPFLAGS_SEQUENCE and 
Str/Bytes/ByteArray_Check. If I'm not wrong, doing so will be 100% reliable, 
identical to isinstance(obj, Sequence), and will be very efficient.

As a side-note, the C-API documentation for TP_FLAGS is not clear atm. It 
mentions for example tp_as_sequence and says "if such a flag bit is clear, the 
type fields it guards must not be accessed and must be considered to have a 
zero or NULL value instead" yet Py_TPFLAGS_SEQUENCE does not actually coincide 
with sequences per specification. I know it has a different explanation as well 
and the flag has its own docstring, but it is still a bit misleading.

--

___
Python tracker 

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



[issue46383] _zoneinfo module_free has invalid function signature

2022-01-15 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset cfbde65df318eea243706ff876e5ef834c085e5f by Christian Heimes in 
branch 'main':
bpo-46383: Fix signature of zoneinfo module_free function (GH-30607)
https://github.com/python/cpython/commit/cfbde65df318eea243706ff876e5ef834c085e5f


--

___
Python tracker 

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



[issue46383] _zoneinfo module_free has invalid function signature

2022-01-15 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46382] dataclass(slots=True) does not account for slots in base classes

2022-01-15 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Arie, can you please explain what is the technical difference between these two 
cases:

```python
class A:
__slots__ = ('a', )
# fields

class B(A):
__slots__ = ('a', 'b')
# fields
```

And:

```python
class C:
__slots__ = ('a', )
# fields

class D(C):
__slots__ = ('b', )
# fields
```

?

--
nosy: +sobolevn

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-15 Thread Aviram


Aviram  added the comment:

I agree that a developer should and would prefer the `Py_TPFLAGS_*` but when 
you visit https://docs.python.org/3/c-api/sequence.html
It seems like the best practice to determine Sequence protocol is by using this 
function, hence leading to confusion. There's no recommendation to use the new 
`Py_TPFLAGS_*`.
To have this knowledge of `Py_TPFLAGS_*` one should be very knowledgable in 
Python's C-API.
How about adding a deprecation note to `PyMapping_Check` & `PySequence_Check` 
in the documentation, suggesting the alternative path (to use 
`PyType_HasFeature`)?

--

___
Python tracker 

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