[issue43787] Optimize BZ2File, GzipFile, and LZMAFile __iter__ method.

2021-04-12 Thread Ma Lin


Change by Ma Lin :


--
nosy: +malin

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-04-12 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24089
pull_request: https://github.com/python/cpython/pull/25354

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, static methods are now callable in Python 3.10. Moreover, @staticmethod and 
@classmethod copy attributes from the callable object, same as 
functools.wraps().

Thanks to this change, I was able to propose to PR 25354 "bpo-43680: 
_pyio.open() becomes a static method".

Serhiy: if you want to "Implement __get__ for C functions", I suggest you 
opening a new issue for that. To be honest, I'm a little bit scared by the 
migration path, I expect that it will require to fix *many* projects.

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



[issue39774] Missing documentation on how to make package executable as script

2021-04-12 Thread igo95862


Change by igo95862 :


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



[issue43654] IDLE: Applying settings disables tab completion

2021-04-12 Thread Mikhail


Mikhail  added the comment:

I also checked this behavior in Jython and IPython, and there errors are 
explicitly caused when putting/calling such values (I also checked on 
MicroPython online version, everything just hangs there). For IPython I created 
an issue on their Github, I'm thinking of doing the same for Jython.
Since you're my guide to the world of bugs and issues for CPython, any advice 
on whether to create a separate issue here or leave it as is?

P.S. I like the Python community, everyone here is kind and helpful :)

--

___
Python tracker 

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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2021-04-12 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +24090
pull_request: https://github.com/python/cpython/pull/25355

___
Python tracker 

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



[issue43811] Run GHA CI with multiple OpenSSL versions

2021-04-12 Thread Christian Heimes


New submission from Christian Heimes :

CI only tests one OpenSSL version, but Python supports multiple versions of 
OpenSSL. OpenSSL 1.0.2, 1.1.0, 1.1.1, and 3.0.0 have different APIs and behave 
differently. We should run minimal tests with all major OpenSSL versions to 
ensure that Python compiles and works with supported versions.

This will slow down CI a bit. I figured out how to include ccache to speed up 
compilation a lot. With populated ccache configure + make takes less than 30 
seconds instead of 90 seconds.

I also noticed that GHA action configuration compiles Python with custom 
OpenSSL but fails to set rpath / LD_LIBRARY_PATH. I think this means that we 
compile with custom OpenSSL but actual tests use OSS' OpenSSL libraries.

--
assignee: christian.heimes
components: SSL, Tests
messages: 390825
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Run GHA CI with multiple OpenSSL versions
type: behavior
versions: 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



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9825bdfbd5c966abf1f1b7264992d722a94c9613 by Jelle Zijlstra in 
branch 'master':
bpo-43723: Deprecate camelCase aliases from threading (GH-25174)
https://github.com/python/cpython/commit/9825bdfbd5c966abf1f1b7264992d722a94c9613


--

___
Python tracker 

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



[issue37804] Remove Thread.isAlive in Python 3.9

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9825bdfbd5c966abf1f1b7264992d722a94c9613 by Jelle Zijlstra in 
branch 'master':
bpo-43723: Deprecate camelCase aliases from threading (GH-25174)
https://github.com/python/cpython/commit/9825bdfbd5c966abf1f1b7264992d722a94c9613


--

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 77d668b1221d0f8c3e9d6b6199f67aaf3c45f040 by Victor Stinner in 
branch 'master':
bpo-43680: _pyio.open() becomes a static method (GH-25354)
https://github.com/python/cpython/commit/77d668b1221d0f8c3e9d6b6199f67aaf3c45f040


--

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-04-12 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24091
pull_request: https://github.com/python/cpython/pull/25357

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-04-12 Thread Mark Shannon


Mark Shannon  added the comment:

This is a significant change to the language.
There should be a PEP, or at the very least a discussion on Python Dev.

There may well be a very good reason why static methods have not been made 
callable before that you have overlooked.

Changing static methods to be callable will break backwards compatibility for 
any code that tests `callable(x)` where `x` is a static method.

I'm not saying that making staticmethods callable is a bad idea, just that it 
needs proper discussion.

https://bugs.python.org/issue20309 was closed as "won't fix". What has changed?

--

___
Python tracker 

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



[issue43811] Run GHA CI with multiple OpenSSL versions

2021-04-12 Thread Christian Heimes


Christian Heimes  added the comment:

Github selects required actions based on the "name" attribute of a job. 
Therefore I decided to keep the default "Ubuntu" job and moved the additional 
OpenSSL tests to another job.

For future reference, my first approach was:

strategy:
  fail-fast: false
  matrix:
openssl_ver: [1.1.1k, 1.0.2u, 1.1.0l, 3.0.0-alpha14]
include:
- openssl_ver: 1.1.1k
  testmode: 'full'
...
- name: Tests
  run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
  if: ${{ matrix.testmode == 'full' }}
- name: SSL tests
  run: ./python Lib/test/ssltests.py
  if: ${{ matrix.testmode != 'full' }}

--

___
Python tracker 

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



[issue43792] Cython is not compatible with Python 3.10 yet: "SystemError: bad argument to internal function"

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:

> This is correct, thanks! The problem is gone with git master version of 
> cython.

master is a different version. I suggest you trying the 0.29.x branch which is 
the actively maintained stable branch.

--

___
Python tracker 

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



[issue22393] multiprocessing.Pool shouldn't hang forever if a worker process dies unexpectedly

2021-04-12 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2021-04-12 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 3447750073aff229b049e4ccd6217db2811dcfd1 by Christian Heimes in 
branch 'master':
bpo-41561: Fix testing with OpenSSL 1.0.2 (GH-25355)
https://github.com/python/cpython/commit/3447750073aff229b049e4ccd6217db2811dcfd1


--

___
Python tracker 

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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2021-04-12 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24092
pull_request: https://github.com/python/cpython/pull/25358

___
Python tracker 

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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2021-04-12 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24093
pull_request: https://github.com/python/cpython/pull/25359

___
Python tracker 

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



[issue43811] Run GHA CI with multiple OpenSSL versions

2021-04-12 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue34309] Trouble when reloading extension modules.

2021-04-12 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue34311] locale.format() and locale.format_string() cast Decimals to float

2021-04-12 Thread Stéphane Wirtel

Change by Stéphane Wirtel :


--
versions: +Python 3.10 -Python 3.8

___
Python tracker 

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



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-12 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes
nosy_count: 5.0 -> 6.0
pull_requests: +24095
pull_request: https://github.com/python/cpython/pull/25361

___
Python tracker 

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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2021-04-12 Thread miss-islington


miss-islington  added the comment:


New changeset 04425a922b598d03770619b0c658ee9874113550 by Miss Islington (bot) 
in branch '3.8':
bpo-41561: Fix testing with OpenSSL 1.0.2 (GH-25355)
https://github.com/python/cpython/commit/04425a922b598d03770619b0c658ee9874113550


--

___
Python tracker 

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



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-12 Thread Christian Heimes


Christian Heimes  added the comment:

The commit broke my PR https://github.com/python/cpython/pull/25329. You missed 
a call in asyncio tests.

--

___
Python tracker 

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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2021-04-12 Thread miss-islington


miss-islington  added the comment:


New changeset 0983e01837714524fb164e784a8e96a2bc4bdf94 by Miss Islington (bot) 
in branch '3.9':
bpo-41561: Fix testing with OpenSSL 1.0.2 (GH-25355)
https://github.com/python/cpython/commit/0983e01837714524fb164e784a8e96a2bc4bdf94


--

___
Python tracker 

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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2021-04-12 Thread Christian Heimes


Change by Christian Heimes :


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



[issue43787] Optimize BZ2File, GzipFile, and LZMAFile __iter__ method.

2021-04-12 Thread Ma Lin


Ma Lin  added the comment:

I think this change is safe.

The behaviors should be exactly the same, except the iterators are different 
objects (obj vs obj._buffer).

--

___
Python tracker 

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



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-12 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 95bbb331ecb3ef5d05859d90b287cc3d27613c86 by Christian Heimes in 
branch 'master':
bpo-43723: Fix deprecation error caused by thread.setDaemon() (GH-25361)
https://github.com/python/cpython/commit/95bbb331ecb3ef5d05859d90b287cc3d27613c86


--

___
Python tracker 

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



[issue43812] Tuple unpacking in getitem

2021-04-12 Thread Jeppe Dakin


New submission from Jeppe Dakin :

This is similar to issue 32117 (I'm the author of the StackOverflow query 
referenced within it), which extends the tuple unpacking syntax to a small 
corner of the language: https://bugs.python.org/issue32117

Currently tuple unpacking is disallowed within getitem (brackets):
d = {(1, 2, 3): 42}
t = (2, 3)
d[1, *t]  # SyntaxError

To make it work, explicit parenthesization is needed:
d[(1, *t)]  # OK


On top of being slightly more neat, the un-parenthesized version is more in 
harmony with the language generally:

1) Parentheses are usually only required in order to distinguish between 
several possible outcomes (grouping). This is not the case here, as leaving out 
the parentheses doesn't produce any outcome at all.

2) Sub-expressions can usually be extracted as a variable. That is, one would 
expect the illegal code
d[1, *t]  # SyntaxError
to be equivalent to the legal code
sub = 1, *t
d[sub]  # OK

3) The following are both allowed and equivalent:
d[1, 2, 3]
d[(1, 2, 3)]
where both gets transformed into d.__getitem__((1, 2, 3)), implying that 
implicit tuple packing occurs in the first case. Having this tuple packing 
feature without allowing for the * unpacking operator feels incomplete.

4) What the syntax d[1, *t] is supposed to mean is obvious, enough so that I 
was surprised to find that it was disallowed. Though hardly a stumbling block, 
I suspect many have written such code, gotten the SyntaxError and remedied the 
code by putting in the (apparently non-superfluous) parentheses.


I propose allowing such tuple unpacking within getitem [], which I believe 
amounts to a slight adjustment of the grammar. This should not break any 
existing code as it merely extends the space of allowed syntax.

--
components: Interpreter Core
messages: 390838
nosy: dakinjeppe
priority: normal
severity: normal
status: open
title: Tuple unpacking in getitem
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue43799] OpenSSL 3.0.0: define OPENSSL_API_COMPAT 1.1.1

2021-04-12 Thread Christian Heimes


Christian Heimes  added the comment:

OpenSSL 1.0.2, 1.1.0, 1.1.1 and 3.0.0 behave slightly differently. For example 
I'm still getting a warning with 1.1.0. Only 3.0.0 supports 
OPENSSL_NO_DEPRECATED.

After multiple failed attempts I decided to set the API level to 1.1.1 and 
define the three TLSv*_method() functions explicitly. It's not the most elegant 
approach but it works. The symbols are available unless OPENSSL_NO_TLS*_METHOD 
is defined.

--

___
Python tracker 

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



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Jelle Zijlstra, I merged your PR! I close issue.

Ok, aliases are now deprecated. If someone wants to actually remove the 
aliases, I suggest to help all projects still using them to fix their 
deprecation warnings:
https://bugs.python.org/issue43723#msg390337

For now, I prefer to not schedule the removal. There are too many projects 
using it. By the way, I'm surprised that this number,  I expected that most 
projects switched since Python 2.6 :-)


Christian:
> The commit broke my PR https://github.com/python/cpython/pull/25329

Usually, warnings are not treated as errors. Thanks for fixing test_asyncio!

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



[issue43682] Make static methods created by @staticmethod callable

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:

Mark Shannon:
> Changing static methods to be callable will break backwards compatibility for 
> any code that tests `callable(x)` where `x` is a static method.

Can you please elaborate on why this is an issue?

In the pydoc case, it sounds like an enhancement:
https://bugs.python.org/issue43682#msg390525

--

___
Python tracker 

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



[issue34311] locale.format() and locale.format_string() cast Decimals to float

2021-04-12 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:


New changeset e126547c070fbc080562abb08e16a2c93a8a805d by Cédric Krier in 
branch 'master':
bpo-34311: Add locale.localize (GH-15275)
https://github.com/python/cpython/commit/e126547c070fbc080562abb08e16a2c93a8a805d


--
nosy: +matrixise

___
Python tracker 

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



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-12 Thread Christian Heimes


Christian Heimes  added the comment:

> Usually, warnings are not treated as errors. Thanks for fixing test_asyncio!

Tests should treat any unhandled deprecation warnings as a test failure.

--

___
Python tracker 

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



[issue34311] locale.format() and locale.format_string() cast Decimals to float

2021-04-12 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

I have merged the PR, thank you to Cédric for the PR, and thank you to Steve 
for his review.

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

___
Python tracker 

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



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-12 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I opened a thread a year back on running tests with -Werror in CI. This issue 
still pops up when someone runs with -Wall and finds unhandled deprecation 
warnings.

https://discuss.python.org/t/run-test-suite-with-werror-on-ci/2333

--

___
Python tracker 

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



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:

> Tests should treat any unhandled deprecation warnings as a test failure.

libregrtest sets a sys.unraisablehook: a test is marked as "failed" if any 
"unraisable exception" is logged.

libregrtest might use a hook on warnings to do the same: log the warning, but 
mark the test as failed?

One issue that I had with libregrtest and sys.unraisablehook was that some 
"unraisable exception" was not logged in buildbot logs. I had to use 
sys.__stderr__ to ensure that the exception is logged. See 
regrtest_unraisable_hook() of test.libregrtest.utils.

It would be annoying to get a test marked as "FAILED" if the warning is not 
visible in logs :-(

---

Using -Werror on some CIs would be another option.

--

___
Python tracker 

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



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:

Oh by the way, if someone wants to enhance libregrtest / our CI, please open a 
new issue ;-) I'm not interested so, I didn't open a new issue :-) Someone also 
once proposed to add a post-commit buildbot using -Werror. It may be enough.

--

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-04-12 Thread Mark Shannon


Mark Shannon  added the comment:

Are you asking why breaking backwards compatibility is an issue?
Or how it breaks backwards compatibility?

pydoc could be changed to produce the proposed output, it doesn't need this 
change.

We don't know what this change will break, but we do know that it is a 
potentially breaking change.
`callable(staticmethod(f))` will change from `False` to `True`.

I don't think you should be making changes like this unilaterally.

--

___
Python tracker 

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



[issue43813] Denial of service on http.server module with large request method.

2021-04-12 Thread Mohammed Dief


New submission from Mohammed Dief :

- Hello there, 2 days ago i discovered a DoS on http.server in python that 
allows me to take any python http.server down using less than 1k requests. i 
reported it to PSRT but they said i should report it here since http.server 
isn't for production. so here's the issue, in server.py http.server library has 
a really big value on the validation. and check if the first line of the 
request (method /path HTTP/VERSION) have more than 65k characters inside of it 
using `len()` function.

- In this case, the user is able to provide a method with 65k characters long 
and the server will accept it, if you send one request with this number of 
characters inside of the request using cURL. you will notice that the server 
could handle it. but after creating a big loop of 1k requests with the same 
characters. the server was taken down and didn't response again since it was 
trying to process this amount of data.

- Such an attack could be used to take down any python server running using 
http.server module. but since it's not for production like the documentations 
said the attack surface isn't that wide.

- To proof this issue, you can use this command while running your server on 
port 8080 or any port you just need to modify the command: for i in $(python3 
-c "print('A\n'*1)"); do curl -X $(python3 -c "print('A'*1)") 
'http://localhost:8080/404' ; done

- Then the server should be taken down after many requests, also, i managed to 
fix this issue from my side by adding characters validation on the code to 
avoid interacting with the long data many times. should i submit it here. or 
should i create a PR? PS, my fix doesn't change the main requestline validation 
int.

--
messages: 390849
nosy: demonia
priority: normal
severity: normal
status: open
title: Denial of service on http.server module with large request method.
type: security
versions: Python 3.6

___
Python tracker 

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



[issue35540] dataclasses.asdict breaks with defaultdict fields

2021-04-12 Thread Alexandru Coca


Alexandru Coca  added the comment:

I was wondering if this issue is still being tracked for resolution? I found 
the same bug in Python 3.8.

--
nosy: +alexcoca

___
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

2021-04-12 Thread Géry

New submission from Géry :

When

```
TypeError: __weakref__ slot disallowed: either we already got one, or 
__itemsize__ != 0
```

is raised, the second condition `base->tp_itemsize != 0` (i.e. the base is a 
*variable-length* type, like `int`, `tuple` and `bytes`) in the error message 
is impossible since using a non-empty `__slots__` (e.g. `__slots__ = 
('__weakref__',)`) for a subtype of a variable-length type raises a

```
TypeError: nonempty __slots__ not supported for subtype of '…'
```

earlier in the `type.__new__` implementation.

--
components: Interpreter Core
messages: 390851
nosy: maggyero
priority: normal
severity: normal
status: open
title: Fix the error message for disallowed __weakref__ slots
type: enhancement
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



[issue43814] Fix the error message for disallowed __weakref__ slots

2021-04-12 Thread Géry

Change by Géry :


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

___
Python tracker 

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



[issue43351] `RecursionError` during deallocation

2021-04-12 Thread Andrew V. Jones


Andrew V. Jones  added the comment:

For us, this issue was resolved with moving to 3.9.2.

I have closed it as it seems it was an "accidentally fixed" 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



[issue33927] Allow json.tool to have identical infile and outfile

2021-04-12 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

Hello @pablogsal,

What do you think about the PR of Rémi?

Thank you,

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



[issue43815] documentation for types.new_class() mention misleading default for exec_body

2021-04-12 Thread Eric V. Smith


New submission from Eric V. Smith :

https://github.com/python/cpython/blob/3.8/Lib/types.py

The documentation says "If no callback is provided, it has the same effect as 
passing in lambda ns: ns."

I read this as saying that the callback should return the namespace, but in 
reality the return value is ignored. I think the lambda should be "lambda ns: 
None".

--
assignee: docs@python
components: Documentation
keywords: easy, newcomer friendly
messages: 390854
nosy: docs@python, eric.smith
priority: normal
severity: normal
status: open
title: documentation for types.new_class() mention misleading default for 
exec_body
versions: 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



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

2021-04-12 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24097
pull_request: https://github.com/python/cpython/pull/25363

___
Python tracker 

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



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

2021-04-12 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24098
pull_request: https://github.com/python/cpython/pull/25364

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-12 Thread Andrew V. Jones

New submission from Andrew V. Jones :

With Python 3.9.4, and when compiling with Visual Studio 2019, we have noticed 
that the variable `_Py_ctype_table` is *not* scoped with in an `extern "C"` 
block, and where the Python library (`python39.lib`) *has* been compiled with a 
C compiler.

This causes an issue when trying to refer to `_Py_ctype_table` from a C++ file, 
as the compiler tries to name-mangle the _use_ of `_Py_ctype_table`, but the 
linker cannot then tie the mangled name to non-mangled named from  
`python39.lib`.

Example:

```
#include "Python.h"
int main() { return _Py_ctype_table[0]; }
```

Compilation:

```
cl.exe /Fe:test.exe /TP /I include test.cpp /link libs/python39.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.cpp
Microsoft (R) Incremental Linker Version 14.28.29336.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
libs/python39.lib
test.obj
test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
unsigned int const * const _Py_ctype_table" (__imp_?_Py_ctype_table@@3QBIB) 
referenced in function main
test.exe : fatal error LNK1120: 1 unresolved externals
```

With `cl.exe`:

```
cl.exe /Bv  
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Compiler Passes:
 Z:\home\avj\visual_studio\MSVC\14.28.29333\bin\HostX64\x64\cl.exe:
Version 19.28.29336.0
 Z:\home\avj\visual_studio\MSVC\14.28.29333\bin\HostX64\x64\c1.dll:
Version 19.28.29336.0
 Z:\home\avj\visual_studio\MSVC\14.28.29333\bin\HostX64\x64\c1xx.dll:  
Version 19.28.29336.0
 Z:\home\avj\visual_studio\MSVC\14.28.29333\bin\HostX64\x64\c2.dll:
Version 19.28.29336.0
 Z:\home\avj\visual_studio\MSVC\14.28.29333\bin\HostX64\x64\c1xx.dll:  
Version 19.28.29336.0
 Z:\home\avj\visual_studio\MSVC\14.28.29333\bin\HostX64\x64\link.exe:  
Version 14.28.29336.0
 Z:\home\avj\visual_studio\MSVC\14.28.29333\bin\HostX64\x64\mspdb140.dll:  
Version 14.28.29336.0
 Z:\home\avj\visual_studio\MSVC\14.28.29333\bin\HostX64\x64\1033\clui.dll: 
Version 19.28.29336.0
```

A naïve check of Python.h (e126547c07) seems to suggest that:

* There are 82 includes

* 64 of these contain `extern "C"`

* 8 do not contain `extern "C"`

* The remaining 10 are either system includes or pyconfig.h

For the 8 that *do not* contain `extern "C"`, none of these use `PyAPI_DATA`. 
This leads me to believe that it is an oversight that `pyctype.h` does not have 
`extern "C"`

--
messages: 390855
nosy: andrewvaughanj
priority: normal
severity: normal
status: open
title: Missing 'extern "C"' for _Py_ctype_table
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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-12 Thread Andrew V. Jones


Change by Andrew V. Jones :


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

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-12 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

In fact, _Py_ctype_table is limited to the internal parts of the interpreter. 
So in this case, this one could not be used in an external tool.

You can read: https://docs.python.org/3/c-api/stable.html

I am not sure that you correctly use the API.

--
nosy: +matrixise

___
Python tracker 

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



[issue43105] [Windows] Can't import extension modules resolved via relative paths in sys.path

2021-04-12 Thread Steve Dower


Change by Steve Dower :


--
assignee:  -> steve.dower
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



[issue41661] os.path.relpath does not document ValueError on Windows with different drives

2021-04-12 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +24100
pull_request: https://github.com/python/cpython/pull/25366

___
Python tracker 

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



[issue41661] os.path.relpath does not document ValueError on Windows with different drives

2021-04-12 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24101
pull_request: https://github.com/python/cpython/pull/25367

___
Python tracker 

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



[issue41661] os.path.relpath does not document ValueError on Windows with different drives

2021-04-12 Thread Steve Dower


Steve Dower  added the comment:


New changeset 67c0b3d89c4da9750fdb43fc66d3924681b22d2e by Zackery Spytz in 
branch 'master':
bpo-41661: Document os.path.relpath() exception on Windows with different 
drives (GH-25346)
https://github.com/python/cpython/commit/67c0b3d89c4da9750fdb43fc66d3924681b22d2e


--

___
Python tracker 

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



[issue41661] os.path.relpath does not document ValueError on Windows with different drives

2021-04-12 Thread Steve Dower


Change by Steve Dower :


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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-12 Thread Andrew V. Jones


Andrew V. Jones  added the comment:

> In fact, _Py_ctype_table is limited to the internal parts of the interpreter. 
> So in this case, this one could not be used in an external tool.
>

Hmm, so why is this "exposed" by the "world-facing" `Python.h` file?

I should say: we found this bug via Cython; and it was Cython that was 
accessing/referring to `_Py_ctype_table` -- our Cythonated code pulls in C++ 
headers, so we need to compile these files as C++.

I am happy to re-assign this as a Cython bug, but the fact it is fixed with an 
`extern "C"` in Python.h, really makes it feel like it is a Python-proper issue 
and not a "user" issue.

--

___
Python tracker 

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



[issue42248] Raised exception in Enum keeping user objects alive unnecessarily

2021-04-12 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 8c14f5a787b21d5a1eae5d5ee981431d1c0e055f by Ethan Furman in 
branch 'master':
bpo-42248: [Enum] ensure exceptions raised in ``_missing_`` are released 
(GH-25350)
https://github.com/python/cpython/commit/8c14f5a787b21d5a1eae5d5ee981431d1c0e055f


--

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-12 Thread Andrew V. Jones


Andrew V. Jones  added the comment:

> I am happy to re-assign this as a Cython bug, but the fact it is fixed with 
> an `extern "C"` in Python.h, really makes it feel like it is a Python-proper 
> issue and not a "user" issue.
>

Just to extend on this:

1) The Cython-generated code uses `Py_ISSPACE` (and not `_Py_ctype_table`), 
but the expansion of the macro `Py_ISSPACE` then adds `_Py_ctype_table` to the 
user's code

2) The "user-fix" is to wrap `#include ` in `extern "C"` -- 
however, given other parts of Python.h already do this, it seems extraneous to 
expect a C++ user to wrap Python.h in this way

--

___
Python tracker 

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



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

2021-04-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 2459b92a4db69d9b14d0a86a9b81cc075894e910 by Victor Stinner in 
branch 'master':
bpo-43774: Remove --without-cycle-gc doc (GH-25364)
https://github.com/python/cpython/commit/2459b92a4db69d9b14d0a86a9b81cc075894e910


--
nosy: +pablogsal

___
Python tracker 

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



[issue43797] Improve syntax error for invalid comparisons

2021-04-12 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue43797] Improve syntax error for invalid comparisons

2021-04-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset b86ed8e3bb41ede77eeab4a8bb4e2b91a8065283 by Pablo Galindo in 
branch 'master':
bpo-43797: Improve syntax error for invalid comparisons (#25317)
https://github.com/python/cpython/commit/b86ed8e3bb41ede77eeab4a8bb4e2b91a8065283


--

___
Python tracker 

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



[issue41661] os.path.relpath does not document ValueError on Windows with different drives

2021-04-12 Thread miss-islington


miss-islington  added the comment:


New changeset de06baa9de109a00c26de0dc5a248fe7aafe09f5 by Miss Islington (bot) 
in branch '3.9':
bpo-41661: Document os.path.relpath() exception on Windows with different 
drives (GH-25346)
https://github.com/python/cpython/commit/de06baa9de109a00c26de0dc5a248fe7aafe09f5


--

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-12 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +C API

___
Python tracker 

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



[issue43492] Upgrade to SQLite 3.35.4 in macOS and Windows

2021-04-12 Thread Big Stone


Big Stone  added the comment:

3.35.4 is there

--
nosy: +Big Stone

___
Python tracker 

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



[issue43761] Documenting dataclass and namedtuple changes for structural pattern matching

2021-04-12 Thread Brandt Bucher


Brandt Bucher  added the comment:

> For named tuples, there isn't an include/exclude option, so no extra mention 
> is warranted.

I think a note in the docs could still be valuable, if only because defining 
__match_args__ for named tuples changes the inherited tuple behavior for 
positional matches quite significantly: "case tuple(x)" and "case MyNT(x)" 
don't mean the same thing.

(Although perhaps this could be inferred from the new constructor signature.)

--

___
Python tracker 

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



[issue42916] Support for DICOM image file format in imghdr module

2021-04-12 Thread Ross Rhodes

Ross Rhodes  added the comment:

PR already open to support DICOM based on the first 132 characters. Marked 
“stale” since I haven’t had any feedback on GitHub, yet.

--

___
Python tracker 

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



[issue43123] email MIME splitting

2021-04-12 Thread Ross Rhodes

Ross Rhodes  added the comment:

PR now “stale” since I have not received any feedback, yet.

--

___
Python tracker 

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



[issue43492] Upgrade to SQLite 3.35.4 in macOS and Windows

2021-04-12 Thread Steve Dower


Steve Dower  added the comment:

It's been a busy month for the SQLite team... hope they're doing okay.

Let's give this one a few weeks, just in case.

--

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-12 Thread Andrew V. Jones


Andrew V. Jones  added the comment:

> 1) The Cython-generated code uses `Py_ISSPACE` (and not `_Py_ctype_table`), 
> but the expansion of the macro `Py_ISSPACE` then adds `_Py_ctype_table` to 
> the user's code
>

I wrote this up as a Cython bug here (just to see if the Cython team consider 
this "their" bug): https://github.com/cython/cython/issues/4111

--

___
Python tracker 

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



[issue42059] TypedDict(...) as function does not respect "total" when setting __required_keys__ and __optional_keys__

2021-04-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

Dominic, thanks so much for the backport!

--

___
Python tracker 

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



[issue42904] get_type_hints does not provide localns for classes

2021-04-12 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 852150ddfe68bc2696fc880175aeb855a0c16ae6 by Ken Jin in branch 
'master':
bpo-42904: Fix get_type_hints for class local namespaces (GH-24201)
https://github.com/python/cpython/commit/852150ddfe68bc2696fc880175aeb855a0c16ae6


--

___
Python tracker 

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



[issue42904] get_type_hints does not provide localns for classes

2021-04-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

Hi Ken Jin, you can close this issue now with your new permissions, right?

--

___
Python tracker 

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



[issue42737] PEP 563: drop annotations for complex assign targets

2021-04-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

Batuhan, can you summarize the argument from the thread? What do you think 
yourself? Myself, I'm not sure either way, but it seems okay to remove the 
remnant bytecode.

--

___
Python tracker 

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



[issue43817] Add typing.eval_annotations()

2021-04-12 Thread Larry Hastings


New submission from Larry Hastings :

Currently, with PEP 563 looming over us, people who use annotations for 
something besides type hints are kind of stuck.  Converting stringized 
annotations back into useful values is a complicated problem, and there's only 
function in the standard library that will do it for you: 
typing.get_type_hints().  However, typing.get_type_hints() deals specifically 
with *type hints*.  Type hints are a subset of annotations, and they have an 
additional set of rules they want to obey.  As such typing.get_type_hints() is 
quite opinionated and makes additional changes to the annotations that someone 
who only wants to un-stringize their annotations likely does not want.

I therefore propose adding a new function to typing:

typing.get_annotations(o)

This would behave similarly to typing.get_type_hints(o), except it would be 
agnostic about the contents of the annotations.  It would simply evaluate them, 
without further changing them as typing.get_type_hints() does.  Specifically:

* It would ignore the "__no_type_check__" attribute.
* It would not wrap string annotations with ForwardRef().
* It would not wrap values with Optional[].
* It would not turn an annotation of None into type(None).
* It would not otherwise change the value of the annotation, in case I missed 
any.

Since the two functions would be so similar, hopefully either they would share 
a common implementation, or typing.get_type_hints() could be implemented on top 
of typing.get_annotations().

Guido, Eric, any thoughts?

--
components: Library (Lib)
messages: 390874
nosy: eric.smith, gvanrossum, larry
priority: normal
severity: normal
stage: needs patch
status: open
title: Add typing.eval_annotations()
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue43817] Add typing.get_annotations()

2021-04-12 Thread Larry Hastings


Larry Hastings  added the comment:

(realized mid-issue-creation that it should have a different name)

--
title: Add typing.eval_annotations() -> Add typing.get_annotations()

___
Python tracker 

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



[issue43817] Add typing.get_annotations()

2021-04-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

It's fair that get_type_hints() does too much. But what does your proposed 
function do besides this?

{k: eval(v) for k, b in x.__annotations__.items()}

?

--

___
Python tracker 

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



[issue43817] Add typing.get_annotations()

2021-04-12 Thread Larry Hastings


Larry Hastings  added the comment:

To be honest, I'm not 100% sure.  But I observe that typing.get_type_hints() is 
about fifty lines of code, and very few of them are the opinionated lines I 
want to avoid.

Some things typing.get_type_hints() seems to do for you:
* Work around the "classes inherit annotations" design bug.
* Unwrap wrapped functions.
* "Return empty annotations for something that _could_ have them."

--

___
Python tracker 

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



[issue43492] Upgrade to SQLite 3.35.4 in macOS and Windows

2021-04-12 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

I agree, Steve.

--

___
Python tracker 

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



[issue43817] Add typing.get_annotations()

2021-04-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'd say just submit the PR. Shouldn't be problematic. (Have you decided
what to do if the eval() fails?)

--

___
Python tracker 

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



[issue30528] ipaddress.IPv{4,6}Network.reverse_pointer is broken

2021-04-12 Thread jana


jana  added the comment:

Running into the same problem here. Within the zonefile rfc1035 defines a 
usecase for ipv4, but I can't find anything similar for IPv6. The feature is 
also rather obscure. The zone however is used in the zonefile as origin and in 
bind in the named.conf to refer to which zone is managed where. 

For this you want to provide the reverse network address, minus the irrelevant 
zeros, so 192.168.0.0/24 => 0.168.192.in-addr.arpa and 2001:db8::/32 => 
8.b.d.0.1.0.0.2.ip6.arpa

This would be to me a fitting and convenient interpretation of the function.

--
nosy: +jana
versions: +Python 3.7 -Python 3.5

___
Python tracker 

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



[issue43817] Add typing.get_annotations()

2021-04-12 Thread Larry Hastings


Larry Hastings  added the comment:

> I'd say just submit the PR. Shouldn't be problematic.

Okey-doke, I can do it.  Though I have plenty to do at the moment, though, so 
it wouldn't be this week.

Is there anybody who would *enjoy* taking this on, who we could farm it out to? 
 If not, that's no problem, I should be able to get it done before 3.10b1.


> (Have you decided what to do if the eval() fails?)

My experience is that typing.get_type_hints() doesn't catch exceptions, e.g. 
NameError.  I assumed that typing.get_annotations() should behave the same way.

--

___
Python tracker 

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



[issue41515] typing.get_type_hints generates KeyError

2021-04-12 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset a9cf69df2e031d6157f01289f66ca9cf723ceb5c by Karthikeyan 
Singaravelan in branch 'master':
bpo-41515: Fix KeyError raised in get_type_hints (GH-25352)
https://github.com/python/cpython/commit/a9cf69df2e031d6157f01289f66ca9cf723ceb5c


--

___
Python tracker 

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



[issue43817] Add typing.get_annotations()

2021-04-12 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue43804] Add more info about building C/C++ Extensions on Windows using MSVC

2021-04-12 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Kindly have a review of my PR.

--

___
Python tracker 

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



[issue30528] ipaddress.IPv{4,6}Network.reverse_pointer is broken

2021-04-12 Thread jana


jana  added the comment:

This code does the trick:

ipn = ipaddress.ip_network("2a0c:ac10::/32")
prefix = ipn.prefixlen
if ipn.version == 6:
rest = int((ipn.max_prefixlen - prefix) / 4)
elif ipn.version == 4:
rest = int((ipn.max_prefixlen - prefix) / 8)
return ipn.network_address.reverse_pointer.split(".", rest)[-1]

--

___
Python tracker 

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



[issue43803] ctypes string_at/wstring_at - bad argument name used in docs and in docstring

2021-04-12 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Yeah, you're right and also it is true that changing the docstring to "ptr" can 
succinctly say "Return the byte string at void *ptr." But it's a kind of 
problem if different argument names are used for the same argument in 
docstring, argument list and documentation. If that's the problem then why not 
change all of them to use the name "address" or "addr" to avoid confusion and 
make it clear simple. What is your view?

--

___
Python tracker 

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



[issue42248] Raised exception in Enum keeping user objects alive unnecessarily

2021-04-12 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +24102
pull_request: https://github.com/python/cpython/pull/25369

___
Python tracker 

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



[issue42248] Raised exception in Enum keeping user objects alive unnecessarily

2021-04-12 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +24103
pull_request: https://github.com/python/cpython/pull/25370

___
Python tracker 

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



[issue43812] Tuple unpacking in getitem

2021-04-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This is currently being proposed as part of 
https://www.python.org/dev/peps/pep-0646.

--
nosy: +pablogsal

___
Python tracker 

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



[issue43812] Tuple unpacking in getitem

2021-04-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am closing this as duplicate of https://www.python.org/dev/peps/pep-0646, but 
feel free to reopen if you think there is some missing considerations.

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

___
Python tracker 

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



[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2021-04-12 Thread Ethan Furman


Ethan Furman  added the comment:

Eryk, I'm not sure if you are agreeing or disagreeing with me. :)

On Windows it sounds like O_TEMPORARY buys us guaranteed file deletion, but 
costs us easy sharing of file resources and a difference in semantics between 
Windows and non-Windows.

Is the automatic deletion truly that valuable?

--

___
Python tracker 

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



[issue42248] Raised exception in Enum keeping user objects alive unnecessarily

2021-04-12 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset f396a1a940f8608a4be2a9ac4ef82e37c198ecd3 by Ethan Furman in 
branch '3.8':
[3.8] bpo-42248: [Enum] ensure exceptions raised in ``_missing_`` are released 
(GH-25350). (GH-25369)
https://github.com/python/cpython/commit/f396a1a940f8608a4be2a9ac4ef82e37c198ecd3


--

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-12 Thread Stefan Behnel


Stefan Behnel  added the comment:

These macros are a sort-of documented part of the C-API. At least, they were 
mentioned in a What's New document:

https://docs.python.org/3/whatsnew/2.7.html?highlight=py_isspace#build-and-c-api-changes

They were added here, for the Py2.7 release:

https://github.com/python/cpython/commit/8374981fb4d781d5ddbca313656bd3f32b49cef4

It looks to me like the header file should use "extern C".
@Eric, do you agree?

--
nosy: +eric.smith, scoder
type:  -> compile error
versions: +Python 3.10

___
Python tracker 

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



[issue30528] ipaddress.IPv{4,6}Network.reverse_pointer is broken

2021-04-12 Thread Roundup Robot


Change by Roundup Robot :


--
nosy: +python-dev
nosy_count: 6.0 -> 7.0
pull_requests: +24104
pull_request: https://github.com/python/cpython/pull/25371

___
Python tracker 

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



[issue41515] typing.get_type_hints generates KeyError

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:

This change introduced a regression:
https://buildbot.python.org/all/#/builders/96/builds/1012

$ ./python -m test test___all__
0:00:00 load avg: 0.28 Run tests sequentially
0:00:00 load avg: 0.28 [1/1] test___all__
test test___all__ failed -- Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/test/test___all__.py", line 104, in 
test_all
self.check_all(modname)
  File "/home/vstinner/python/master/Lib/test/test___all__.py", line 25, in 
check_all
exec("import %s" % modname, names)
  File "/home/vstinner/python/master/Lib/contextlib.py", line 140, in __exit__
next(self.gen)
  File "/home/vstinner/python/master/Lib/test/support/warnings_helper.py", line 
177, in _filterwarnings
raise AssertionError("unhandled warning %s" % reraise[0])
AssertionError: unhandled warning {message : SyntaxWarning('assertion is always 
true, perhaps remove parentheses?'), category : 'SyntaxWarning', filename : 
'/home/vstinner/python/master/Lib/test/test_typing.py', lineno : 2275, line : 
None}

test___all__ failed

== Tests result: FAILURE ==

1 test failed:
test___all__

Total duration: 2.7 sec
Tests result: FAILURE


It comes from the following line of test_bad_module() in Lib/test/test_typing:

assert(get_type_hints(BadModule), {})

assert should be used as "assert test" or "assert test, expr". assert (expr, 
expr) tests if the tuple (2 items) is true, and it's always true.

--
nosy: +vstinner

___
Python tracker 

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



[issue41515] typing.get_type_hints generates KeyError

2021-04-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks -- odd this didn't fail in CI. We'll get it fixed.

--

___
Python tracker 

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



[issue41515] typing.get_type_hints generates KeyError

2021-04-12 Thread STINNER Victor


STINNER Victor  added the comment:

> Thanks -- odd this didn't fail in CI.

The CI runs tests with "make buildbottest" which uses the -w option:

  -w, --verbose2re-run failed tests in verbose mode

When test___all__ is re-run in verbose mode, it doesn't fail:

"== Tests result: FAILURE then SUCCESS =="

--

___
Python tracker 

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



[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2021-04-12 Thread Steve Dower


Steve Dower  added the comment:

O_TEMPORARY is clearly not the right option here, and we should just move the 
unlink call into __exit__ and attempt it even if close() has been called.

Windows's "delete on close" functionality is great, but if you haven't designed 
for its semantics, it's unusable. And this library is not designed for it, so 
users can't rely on the native functionality.

So we stop passing the O_TEMPORARY flag. If __enter__() is called, close() 
closes the file but doesn't delete anything, and __exit__() closes the file (if 
open) and deletes it (even if it wasn't open). If there is no __enter__(), 
close() also deletes the file.

--

___
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

2021-04-12 Thread Stefan Behnel

Stefan Behnel  added the comment:

> why /shouldn't/ we make the change?

It breaks doctests, and probably some other unit tests, too, e.g. for output 
formatting.

What should we suggest users to do? Replace

>>> get_flag(…)


by

>>> get_flag(…) == app_enums.TrickyFlag  or get_flag(…)  # (also show 
result on failure)
True

and

assertEqual(
"You caught the %s flag!" % result,
"You caught the app_enums.TrickyFlag flag!")

by

assertEqual(
("You caught the %s flag!" % result).replace("app_enums.", ""),
"You caught the TrickyFlag flag!")

?

Note that using "%r" does not help, since it's also backwards incompatible.

For their own enums, users can probably backport (or forward-port) "__str__()" 
and "__repr__()" themselves in order to work around this difference. But it's 
something they would have to do.

I certainly understand the reasoning, and it also makes new Py3.10-only 
doctests nicer, actually, but IMHO it counts as deliberate breakage.

--
nosy: +scoder

___
Python tracker 

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



  1   2   >