[issue37674] Is imp module deprecated or pending deprecation?

2020-05-27 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 5.0 -> 6.0
pull_requests: +19729
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20480

___
Python tracker 

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



[issue40800] asyncio.sleep(0) should "yield" back to the event loop, but it doesn't behave as expected

2020-05-27 Thread Davy Durham


New submission from Davy Durham :

I was searching for a way to "yield" from task/coroutinue back to the event 
loop (not yielding a value in terms of a generator) and not finding anything 
documented, I found this bug report and PR: 
   https://github.com/python/asyncio/issues/284

It states that asyncio.sleep(0) should cause the coroutine to send control back 
to the event loop without wastefully doing other work.  That makes sense and a 
perfectly good way to do that.

And, the code appears to handle a value of <= 0 specifically: 
https://github.com/python/cpython/blob/3.8/Lib/asyncio/tasks.py#L632

However, using sleep(0) to yield back does not cause it to raise a 
CancelledError if the task has been cancelled as cancel()'s documentation 
indicates it should.  But sleeping for anything >0 does (e.g. 0.001)

The below code snippet will demonstrate the problem:

TIA



import asyncio
import time

async def cancel_me():
print('cancel_me(): before sleep')

try:
while True:
print("doing some really intensive cpu stuff")
time.sleep(2)

# now I want to yield control back to the event loop in order to 
determine if we've been cancelled 
await asyncio.sleep(0) # I'm expecting this to throw 
CancelledError, but it never does.. it DOES throw if the delay > 0 (e.g. 0.001)

except asyncio.CancelledError:
print('cancel_me(): cancelled!')
raise



async def main():
task = asyncio.create_task(cancel_me())

await asyncio.sleep(1)

task.cancel()
try:
await task
except asyncio.CancelledError:
print("main(): cancel_me is cancelled now")

asyncio.run(main())

--
components: asyncio
messages: 370164
nosy: Davy Durham, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.sleep(0) should "yield" back to the event loop, but it doesn't 
behave as expected
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-27 Thread hai shi


Change by hai shi :


--
pull_requests: +19728
pull_request: https://github.com/python/cpython/pull/20479

___
Python tracker 

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



[issue37824] IDLE: Handle Shell input warnings properly.

2020-05-27 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue37824] IDLE: Handle Shell input warnings properly.

2020-05-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

codeop._maybe_compile wraps each compile in try ... except SyntaxError.  It can 
later reraise just once.  I think it a bug that it is not similarly careful 
about SyntaxWarning and DeprecationWarning to only emit a particular warning 
just once.

Cheryl, would you like to open a new issue and submit a patch?

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



[issue40790] Python should enable computed gotos on Mac by default

2020-05-27 Thread laike9m


laike9m  added the comment:

Hi Benjamin, do you mean that disabling computed gotos on Mac is the expected 
behavior?

--

___
Python tracker 

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



[issue14562] urllib2 maybe blocks too long with small chunks

2020-05-27 Thread Benjamin Peterson


Change by Benjamin Peterson :


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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-27 Thread Kyle Stanley


Kyle Stanley  added the comment:

> The new test_sock_client_racing() test seems to have... a race condition...

I'm also a bit skeptical about relying on `time.sleep(0.01)` at the end of the 
loop in `_basetest_sock_recv_racing()`, but I don't have an idea for a better 
approach at the moment.

--

___
Python tracker 

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



[issue40799] Create Lib/_pydecimal.py file to optimize "import datetime" when _decimal is available

2020-05-27 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue30665] pass big values for arg to fcntl.ioctl

2020-05-27 Thread Ned Deily


Change by Ned Deily :


--
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue39939] PEP 616: Add str.removeprefix and str.removesuffix methods

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset de6b6841098e1a5967cb7a50b665ca7473d0ddad by Miss Islington (bot) 
in branch '3.9':
bpo-39939: Fix removeprefix issue number in the What's New in Python 3.9 
(GH-20473) (GH-20474)
https://github.com/python/cpython/commit/de6b6841098e1a5967cb7a50b665ca7473d0ddad


--

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-27 Thread Fantix King


Fantix King  added the comment:

Not a simple one - FreeBSD is returning ECONNREFUSED immediately when trying to 
connect to a non-listening port on the loopback address:

https://lists.freebsd.org/pipermail/freebsd-current/2005-May/049876.html

Then all following connect attempts on the same socket return ECONNREFUSED 
regardless of whether the port is listening or not. I think I'll have to skip 
this test on FreeBSD.

--

___
Python tracker 

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



[issue39939] PEP 616: Add str.removeprefix and str.removesuffix methods

2020-05-27 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 9.0 -> 10.0
pull_requests: +19727
pull_request: https://github.com/python/cpython/pull/20474

___
Python tracker 

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



[issue39939] PEP 616: Add str.removeprefix and str.removesuffix methods

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 56853d8ec6ed89bf5a9b81c3781a4df46ac391d3 by Elazar Gershuni in 
branch 'master':
 bpo-39939: Fix removeprefix issue number in the What's New in Python 3.9 
(GH-20473)
https://github.com/python/cpython/commit/56853d8ec6ed89bf5a9b81c3781a4df46ac391d3


--

___
Python tracker 

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



[issue39939] PEP 616: Add str.removeprefix and str.removesuffix methods

2020-05-27 Thread Elazar Gershuni


Change by Elazar Gershuni :


--
nosy: +elazar
nosy_count: 8.0 -> 9.0
pull_requests: +19726
pull_request: https://github.com/python/cpython/pull/20473

___
Python tracker 

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



[issue37028] Implement asyncio repl

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

This issue is now closed. If someone wants to enhane the asyncio REPL, please 
open a new issue.

--
resolution:  -> fixed

___
Python tracker 

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



[issue37129] Add os.RWF_APPEND flag for os.pwritev

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks YoSTEALTH.

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



[issue23897] Update Python 3 extension module porting guide

2020-05-27 Thread Sumana Harihareswara


Sumana Harihareswara  added the comment:

Following the large rewrite in https://github.com/python/cpython/pull/9317 to 
point to other guides (including py3c) instead of providing a guide, should we

a) add a pointer to Barry's notes as well
b) migrate this bug to request enhancements to py3c docs or 
http://python3porting.com/cextensions.html
c) something else?

--
keywords: +patch
message_count: 1.0 -> 2.0
nosy: +sumanah
nosy_count: 6.0 -> 7.0
pull_requests: +19725
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/9317

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-40799: Create Lib/_pydecimal.py file to optimize "import datetime" 
when _decimal is available.

--

___
Python tracker 

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



[issue40799] Create Lib/_pydecimal.py file to optimize "import datetime" when _decimal is available

2020-05-27 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue40799] Create Lib/_pydecimal.py file to optimize "import datetime" when _decimal is available

2020-05-27 Thread Ezio Melotti


Change by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue40799] Create Lib/_pydecimal.py file to optimize "import datetime" when _decimal is available

2020-05-27 Thread STINNER Victor


New submission from STINNER Victor :

Currently, "import datetime" starts by importing time, math, sys and operator 
modules, and then execute 2500 lines of Python code, define 7 classes, etc. For 
what? Just to remove all classes, functions, etc. to replace them with symbols 
from _decimal module:
---
try:
from _datetime import *
except ImportError:
pass
else:
# Clean up unused names
del (_DAYNAMES, _DAYS_BEFORE_MONTH, _DAYS_IN_MONTH, _DI100Y, _DI400Y,
 _DI4Y, _EPOCH, _MAXORDINAL, _MONTHNAMES, _build_struct_time,
 _check_date_fields, _check_time_fields,
 _check_tzinfo_arg, _check_tzname, _check_utc_offset, _cmp, _cmperror,
 _date_class, _days_before_month, _days_before_year, _days_in_month,
 _format_time, _format_offset, _index, _is_leap, _isoweek1monday, _math,
 _ord2ymd, _time, _time_class, _tzinfo_class, _wrap_strftime, _ymd2ord,
 _divide_and_round, _parse_isoformat_date, _parse_isoformat_time,
 _parse_hh_mm_ss_ff, _IsoCalendarDate)
# XXX Since import * above excludes names that start with _,
# docstring does not get overwritten. In the future, it may be
# appropriate to maintain a single module level docstring and
# remove the following line.
from _datetime import __doc__
---

I would prefer to use the same approach than the decimal module which also has 
large C and Python implementation. Lib/decimal.py is just:
---
try:
from _decimal import *
from _decimal import __doc__
from _decimal import __version__
from _decimal import __libmpdec_version__
except ImportError:
from _pydecimal import *
from _pydecimal import __doc__
from _pydecimal import __version__
from _pydecimal import __libmpdec_version__
---

Advantages:

* Faster import time
* Avoid importing indirectly time, math, sys and operator modules, whereas they 
are not used

IMO it also better separate the C and the Python implementations.


Attached PR implements this idea.


Currently, "import datetime" imports 4 modules:

  ['_operator', 'encodings.ascii', 'math', 'operator']

With the PR, "import datetime"  imports only 1 module:

  ['encodings.ascii']

Import performance:

  [ref] 814 us +- 32 us -> [change] 189 us +- 4 us: 4.31x faster (-77%)

Measured by:

  env/bin/python -m pyperf timeit -s 'import sys' 'import datetime; del 
sys.modules["datetime"]; del sys.modules["_datetime"]; del datetime'


Note: I noticed that "import datetime" imports the math module while working on 
minimizing "import test.support" imports, bpo-40275.

--
components: Library (Lib)
messages: 370153
nosy: vstinner
priority: normal
severity: normal
status: open
title: Create Lib/_pydecimal.py file to optimize "import datetime" when 
_decimal is available
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



[issue40275] test.support has way too many imports

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset aa890630bc877c73ec806c9982d8b7b2e7019723 by Victor Stinner in 
branch 'master':
bpo-40275: test.support imports subprocess lazily (GH-20471)
https://github.com/python/cpython/commit/aa890630bc877c73ec806c9982d8b7b2e7019723


--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

Attached count_imports.py script counts how many modules are imported by 
"import test.support".

With PR 20471, we are down to 74 modules. It's way better than 171 (when I 
created this issue)!

--
Added file: https://bugs.python.org/file49197/count_imports.py

___
Python tracker 

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



[issue39073] [security] email module incorrect handling of CR and LF newline characters in Address objects.

2020-05-27 Thread Ned Deily


Ned Deily  added the comment:


New changeset 7df32f844efed33ca781a016017eab7050263b90 by Miss Islington (bot) 
in branch '3.6':
bpo-39073: validate Address parts to disallow CRLF (GH-19007) (#19224)
https://github.com/python/cpython/commit/7df32f844efed33ca781a016017eab7050263b90


--
nosy: +ned.deily

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-27 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19723
pull_request: https://github.com/python/cpython/pull/20471

___
Python tracker 

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



[issue40797] multiprocessing.Semaphore has undocumented get_value() method

2020-05-27 Thread Ned Deily


Change by Ned Deily :


--
nosy: +davin, pitrou

___
Python tracker 

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



[issue40798] The deprecated-removed Sphinx extension need to change the error message based on the Python version

2020-05-27 Thread Ned Deily


Change by Ned Deily :


--
nosy: +mdk

___
Python tracker 

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



[issue40795] ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure

2020-05-27 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8

___
Python tracker 

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



[issue40795] ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure

2020-05-27 Thread miss-islington


miss-islington  added the comment:


New changeset 9e3c583954f75a6396d1935e000df85d89b78a3d by Miss Islington (bot) 
in branch '3.9':
bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
https://github.com/python/cpython/commit/9e3c583954f75a6396d1935e000df85d89b78a3d


--

___
Python tracker 

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



[issue40795] ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure

2020-05-27 Thread miss-islington


miss-islington  added the comment:


New changeset 45ce0dbc4f8c68fe22ae97860faa8f2ec7faf27b by Miss Islington (bot) 
in branch '3.8':
bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
https://github.com/python/cpython/commit/45ce0dbc4f8c68fe22ae97860faa8f2ec7faf27b


--

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-27 Thread Fantix King


Fantix King  added the comment:

Ouch ... looks like FreeBSD also needs a few more retries than a single retry. 
I'll test on a FreeBSD and create a PR for that.

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b0461e19b5ecb2d89917b23efb5ce1048fab1b22 by Victor Stinner in 
branch 'master':
bpo-40275: test.support.check_impl_detail() uses sys.implementation (GH-20468)
https://github.com/python/cpython/commit/b0461e19b5ecb2d89917b23efb5ce1048fab1b22


--

___
Python tracker 

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



[issue40795] ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure

2020-05-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19722
pull_request: https://github.com/python/cpython/pull/20470

___
Python tracker 

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



[issue40795] ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 10228bad0452d94e66c964b625a0b61befa08e59 by Victor Stinner in 
branch 'master':
bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
https://github.com/python/cpython/commit/10228bad0452d94e66c964b625a0b61befa08e59


--

___
Python tracker 

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



[issue40795] ctypes: PyErr_WriteUnraisable() called with no exception set on converting callback result failure

2020-05-27 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 1.0 -> 2.0
pull_requests: +19721
pull_request: https://github.com/python/cpython/pull/20469

___
Python tracker 

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



[issue27779] Sync-up docstrings in C version of the the decimal module

2020-05-27 Thread Furkan Onder


Furkan Onder  added the comment:

Patches are prepared but not continued. It can  be merge by  small additions to 
the patches.

--
nosy: +furkanonder

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-27 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19720
pull_request: https://github.com/python/cpython/pull/20468

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

The new test_sock_client_racing() test seems to have... a race condition...

AMD64 FreeBSD Non-Debug 3.9:
https://buildbot.python.org/all/#/builders/750/builds/11

ERROR: test_sock_client_racing 
(test.test_asyncio.test_sock_lowlevel.KqueueEventLoopTests)
ERROR: test_sock_client_racing 
(test.test_asyncio.test_sock_lowlevel.PollEventLoopTests)
ERROR: test_sock_client_racing 
(test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests)

Example:

ERROR: test_sock_client_racing 
(test.test_asyncio.test_sock_lowlevel.PollEventLoopTests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.9.koobs-freebsd-9e36.nondebug/build/Lib/test/test_asyncio/test_sock_lowlevel.py",
 line 216, in _basetest_sock_connect_racing
await self.loop.sock_connect(sock, addr)
  File 
"/usr/home/buildbot/python/3.9.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/selector_events.py",
 line 500, in sock_connect
return await fut
  File 
"/usr/home/buildbot/python/3.9.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/selector_events.py",
 line 505, in _sock_connect
sock.connect(address)
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.9.koobs-freebsd-9e36.nondebug/build/Lib/test/test_asyncio/test_sock_lowlevel.py",
 line 253, in test_sock_client_racing
self.loop.run_until_complete(asyncio.wait_for(
  File 
"/usr/home/buildbot/python/3.9.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/base_events.py",
 line 642, in run_until_complete
return future.result()
  File 
"/usr/home/buildbot/python/3.9.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/tasks.py",
 line 496, in wait_for
return fut.result()
  File 
"/usr/home/buildbot/python/3.9.koobs-freebsd-9e36.nondebug/build/Lib/test/test_asyncio/test_sock_lowlevel.py",
 line 219, in _basetest_sock_connect_racing
await self.loop.sock_connect(sock, addr)
  File 
"/usr/home/buildbot/python/3.9.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/selector_events.py",
 line 500, in sock_connect
return await fut
  File 
"/usr/home/buildbot/python/3.9.koobs-freebsd-9e36.nondebug/build/Lib/asyncio/selector_events.py",
 line 505, in _sock_connect
sock.connect(address)
ConnectionRefusedError: [Errno 61] Connection refused

--
nosy: +vstinner

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e80697d687b610bd7fb9104af905dec8f0bc55a7 by Hai Shi in branch 
'master':
bpo-40275: Adding threading_helper submodule in test.support (GH-20263)
https://github.com/python/cpython/commit/e80697d687b610bd7fb9104af905dec8f0bc55a7


--

___
Python tracker 

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



[issue40798] The deprecated-removed Sphinx extension need to change the error message based on the Python version

2020-05-27 Thread Rémi Lapeyre

New submission from Rémi Lapeyre :

The new deprecated-removed extension in the documentation always produces text 
like this:

   Deprecated since version 3.4, will be removed in version 3.8: MD5 as 
implicit default digest

This message should be used in the documentation of 3.4 to 3.7 and then it 
should produce:

   Deprecated since version 3.4, removed in version 3.8: MD5 as implicit 
default digest

I'm not sure if Sphinx knows which Python version it is building the 
documentation for.

This is the only instance were this is used with a version less than 3.9 so all 
other messages are currently correct.

I think a new contributor should be able to fix this.

--
assignee: docs@python
components: Documentation
messages: 370141
nosy: docs@python, remi.lapeyre
priority: normal
severity: normal
status: open
title: The deprecated-removed Sphinx extension need to change the error message 
based on the Python version
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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7d80b35af1ee03834ae4af83e920dee89c2bc273 by Pablo Galindo in 
branch 'master':
Revert "bpo-32604: PEP 554 for use in test suite (GH-19985)" (#20465)
https://github.com/python/cpython/commit/7d80b35af1ee03834ae4af83e920dee89c2bc273


--

___
Python tracker 

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



[issue37129] Add os.RWF_APPEND flag for os.pwritev

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 76ef255bde772005bbd0761399b274c2240e61d3 by YoSTEALTH in branch 
'master':
bpo-37129: Add os.RWF_APPEND flag for os.pwritev() (GH-20336)
https://github.com/python/cpython/commit/76ef255bde772005bbd0761399b274c2240e61d3


--

___
Python tracker 

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



[issue2897] PyMemberDef missing in limited API / Deprecate structmember.h

2020-05-27 Thread Matthias Braun


Matthias Braun  added the comment:

While working on the pull request I felt that the type and constants better fit 
`descrobject.h` rather than `object.h`.

--

___
Python tracker 

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



[issue34204] Bump the default pickle protocol in shelve

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote a short script to see the impact of file size depending on the protocol:
---
import shelve
import os.path

print("== Short value ==")
for proto in (0, 1, 2, 3, 4, 5):
filename = 'shelve-picklev%s' % proto
with shelve.open(filename, protocol=proto) as db:
assert db._protocol == proto
for x in range(1000):
db[str(x)] = str(x)
print(f'Protocol {proto}: {os.path.getsize(filename)} bytes')
os.unlink(filename)
print()
print("== Large value ==")
large_value = [str(x) for x in range(1000)]
for proto in (0, 1, 2, 3, 4, 5):
filename = 'shelve-picklev%s' % proto
with shelve.open(filename, protocol=proto) as db:
assert db._protocol == proto
for x in range(10):
db[str(x)] = large_value
print(f'Protocol {proto}: {os.path.getsize(filename)} bytes')
os.unlink(filename)
---

Output with Python 3.9.0b1 (on Fedora 32):
---
== Short value ==
Protocol 0: 90112 bytes
Protocol 1: 94208 bytes
Protocol 2: 94208 bytes
Protocol 3: 94208 bytes
Protocol 4: 94208 bytes
Protocol 5: 94208 bytes

== Large value ==
Protocol 0: 139264 bytes
Protocol 1: 139264 bytes
Protocol 2: 139264 bytes
Protocol 3: 139264 bytes
Protocol 4: 98304 bytes
Protocol 5: 98304 bytes
---

For short string values, protocol 0 produces smaller files than protocol 1 and 
higher.

For large value, protocol 4 and higher produce smaller files than protocol 3 
and lower.

--
nosy: +vstinner

___
Python tracker 

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



[issue40690] unittest: if FunctionTestCase is imported, the loader loads "tests" from it

2020-05-27 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I checked and FunctionTestCase seems to completely break the loader. The tests 
for FunctionTestCase in the standard library instantiate the class from inside 
the method of a TestCase so the loader never see them but even the simple test 
file I attached completely  breaks:

✗ python3 -m unittest
E
==
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", 
line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", 
line 86, in _run_code
exec(code, run_globals)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/__main__.py",
 line 18, in 
main(module=None)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/main.py",
 line 101, in __init__
self.runTests()
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/main.py",
 line 271, in runTests
self.result = testRunner.run(self.test)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/runner.py",
 line 183, in run
result.printErrors()
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/runner.py",
 line 109, in printErrors
self.printErrorList('ERROR', self.errors)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/runner.py",
 line 115, in printErrorList
self.stream.writeln("%s: %s" % (flavour,self.getDescription(test)))
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/runner.py",
 line 47, in getDescription
return '\n'.join((str(test), doc_first_line))
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/case.py",
 line 1472, in __str__
self._testFunc.__name__)
AttributeError: 'str' object has no attribute '__name__'



I look at plenty of usages of FunctionTestCase on Github and all of them seemed 
to be false positive, they were copies of the 
unittest/test/test_functiontestcase.py file

The patch in the attached PR is not correct thought, it only fixes one of the 
loader and all of them suffer from the same issue.

--
versions: +Python 3.10
Added file: https://bugs.python.org/file49196/test_functiontest.py

___
Python tracker 

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



[issue40614] ast.parse doesn't respect feature_version for debug f-strings

2020-05-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 9b83829e7d476acecc86d48978acc5813ec51e65 by Pablo Galindo in 
branch '3.9':
[3.9] bpo-40614: Respect feature version for f-string debug expressions 
(GH-20196) (GH-20464)
https://github.com/python/cpython/commit/9b83829e7d476acecc86d48978acc5813ec51e65


--

___
Python tracker 

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



[issue40780] float.__format__() handles trailing zeros inconsistently in “general” format

2020-05-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

+1 for 3.9 and later.

--
nosy: +rhettinger

___
Python tracker 

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



[issue37028] Implement asyncio repl

2020-05-27 Thread Matthias Bussonnier

Matthias Bussonnier  added the comment:

> Compared to the vanilla REPL, this doesn’t include readline setup for tab 
> completion and history file.  Was it on purpose?

Not particularly, it was mostly to show it is possible. I'm guessing any 
improvement to make it more consistent with the normal REPL would be welcome. 

If you want a fancier repl that also have these features it should work out of 
the box with IPython.

--

___
Python tracker 

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



[issue40614] ast.parse doesn't respect feature_version for debug f-strings

2020-05-27 Thread Shantanu


Change by Shantanu :


--
pull_requests: +19718
pull_request: https://github.com/python/cpython/pull/20466

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-27 Thread miss-islington


miss-islington  added the comment:


New changeset 3a2667d91e33493ccde113ddf5092afefc3c89fa by Miss Islington (bot) 
in branch '3.9':
bpo-30064: Fix asyncio loop.sock_* race condition issue (GH-20369)
https://github.com/python/cpython/commit/3a2667d91e33493ccde113ddf5092afefc3c89fa


--

___
Python tracker 

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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-05-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Commit 9d17cbf33df7cfb67ca0f37f6463ba5c18676641 is causing all refleak 
buildbots to fail and is masking other issues and causing some confusion 
already in other PRs (like https://github.com/python/cpython/pull/20433) so I 
opened a revert in PR 20465 following the buildbot revert policy 
(https://discuss.python.org/t/policy-to-revert-commits-on-buildbot-failure/404).

Please, open a new PR with this change again once the refleaks have been 
resolved.

--

___
Python tracker 

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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-05-27 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal
nosy_count: 13.0 -> 14.0
pull_requests: +19717
pull_request: https://github.com/python/cpython/pull/20465

___
Python tracker 

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



[issue40614] ast.parse doesn't respect feature_version for debug f-strings

2020-05-27 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +19716
pull_request: https://github.com/python/cpython/pull/20464

___
Python tracker 

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



[issue40797] multiprocessing.Semaphore has undocumented get_value() method

2020-05-27 Thread Rémi Lapeyre

New submission from Rémi Lapeyre :

The threading.Semaphore class does not have this method, it is undocumented and 
useless on some system (at least MacOS):

>>> s.get_value()
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/synchronize.py",
 line 129, in get_value
return self._semlock._get_value()
NotImplementedError



The implementation is at 
https://github.com/python/cpython/blob/master/Modules/_multiprocessing/semaphore.c#L537-L553

I think this method could be removed, since it's undocumented and probably not 
used can I just remove it or does it need a deprecation cycle?

--
components: Library (Lib)
messages: 370128
nosy: remi.lapeyre
priority: normal
severity: normal
status: open
title: multiprocessing.Semaphore has undocumented get_value() method
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



[issue40614] ast.parse doesn't respect feature_version for debug f-strings

2020-05-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset c116c94ff119485761460f1033cdee425bed0310 by Shantanu in branch 
'master':
bpo-40614: Respect feature version for f-string debug expressions (GH-20196)
https://github.com/python/cpython/commit/c116c94ff119485761460f1033cdee425bed0310


--
nosy: +pablogsal

___
Python tracker 

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



[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-27 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I expect the best decision to be to get rid of tempfile.tempdir entirely.  That 
would need be its own issue with a deprecation period involved.

A process global that alters behavior of all calls into a module that don't 
explicitly opt-out is a bad API.

--

___
Python tracker 

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



[issue2897] PyMemberDef missing in limited API / Deprecate structmember.h

2020-05-27 Thread Matthias Braun


Change by Matthias Braun :


--
pull_requests: +19715
stage: commit review -> patch review
pull_request: https://github.com/python/cpython/pull/20462

___
Python tracker 

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



[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Well, the behavior for an existing bytes path was not unintended, but some 
people can depend on it.

But before making it an official feature, we should also check other cases of 
an unintended behavior. What if set tempfile.tempdir to a Path object or to a 
file descriptor of a directory? Does anything work in these cases and should we 
support them?

--

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +19714
pull_request: https://github.com/python/cpython/pull/20461

___
Python tracker 

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-05-27 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset b5ecbf02e4dbdea6d1c9a6d7189137f76e70c073 by Miss Islington (bot) 
in branch '3.8':
bpo-40025: Require _generate_next_value_ to be defined before members(GH-19763)
https://github.com/python/cpython/commit/b5ecbf02e4dbdea6d1c9a6d7189137f76e70c073


--

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset db5aed931f8a617f7b63e773f62db468fe9c5ca1 by Christian Heimes in 
branch 'master':
bpo-40791: Use CRYPTO_memcmp() for compare_digest (#20456)
https://github.com/python/cpython/commit/db5aed931f8a617f7b63e773f62db468fe9c5ca1


--

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-27 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-27 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset 210a137396979d747c2602eeef46c34fc4955448 by Fantix King in branch 
'master':
bpo-30064: Fix asyncio loop.sock_* race condition issue (#20369)
https://github.com/python/cpython/commit/210a137396979d747c2602eeef46c34fc4955448


--

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I'd feel fine doing that for 3.9 given 3.9.0 is only in beta and this changes 
no public APIs.  For 3.8 and 3.7 i wouldn't.

Be sure to update the versionchanged in the docs if you choose to do it for 3.9.

--

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Christian Heimes


Christian Heimes  added the comment:

Greg, is GH-20456 a bug fix / security enhancement or a new feature? I'm 
hesitant to backport it to 3.7 and 3.8. 3.9 might be ok.

--

___
Python tracker 

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



[issue27657] urlparse fails if the path is numeric

2020-05-27 Thread Michał Górny

Michał Górny  added the comment:

I'm sorry but does this change mean that it's not final or...?

My main concern is whether we should be adjusting our packages to the new 
behavior in py3.9, or wait for further changes.

--

___
Python tracker 

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



[issue40787] Mysql + unittest crash

2020-05-27 Thread Lucas


Lucas  added the comment:

The problem was that I didn't close the 1st connection to the database and then 
made another request, which had to wait for the 1st to close, to be exact.

--

___
Python tracker 

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



[issue37028] Implement asyncio repl

2020-05-27 Thread Éric Araujo

Éric Araujo  added the comment:

Compared to the vanilla REPL, this doesn’t include readline setup for tab 
completion and history file.  Was it on purpose?

--
nosy: +eric.araujo

___
Python tracker 

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



[issue40787] Mysql + unittest crash

2020-05-27 Thread Lucas


Lucas  added the comment:

While trying to simplify my program for you, I found that the problem was 
caused by a very specific interaction of one of the functions that was being 
tested with the restore command, which did not happen when I tried to rule this 
problem out in other ways.

Anyways, thank you for your time.

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



[issue40796] dataclasses.make_dataclass: Exception when called with different field orders

2020-05-27 Thread Darrick Yee


Darrick Yee  added the comment:

Yes, that makes sense. Thank you!

On Wed, May 27, 2020, 1:40 PM Eric V. Smith  wrote:

>
> Eric V. Smith  added the comment:
>
> No problem!
>
> It can't reorder fields, because you might not be passing them by name.
> There's some discussion about requiring keyword-only parameters, in which
> case what you're doing would work (as long as they were keyword-only
> params).
>
> --
> resolution:  -> not a bug
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40796] dataclasses.make_dataclass: Exception when called with different field orders

2020-05-27 Thread Eric V. Smith


Eric V. Smith  added the comment:

No problem!

It can't reorder fields, because you might not be passing them by name. There's 
some discussion about requiring keyword-only parameters, in which case what 
you're doing would work (as long as they were keyword-only params).

--
resolution:  -> not a bug

___
Python tracker 

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



[issue40796] dataclasses.make_dataclass: Exception when called with different field orders

2020-05-27 Thread Darrick Yee


Darrick Yee  added the comment:

TypeError: non-default argument 'field1' follows default argument

You are right.  For some reason I believed it would automatically gather the 
required fields first when creating the new class' signature.

--

___
Python tracker 

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



[issue40796] dataclasses.make_dataclass: Exception when called with different field orders

2020-05-27 Thread Darrick Yee


Change by Darrick Yee :


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



[issue40796] dataclasses.make_dataclass: Exception when called with different field orders

2020-05-27 Thread Eric V. Smith


Eric V. Smith  added the comment:

Isn't this error that you're providing a field without a default value after 
one with a default value?

What's the exception look like?

--
nosy: +eric.smith

___
Python tracker 

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



[issue40796] dataclasses.make_dataclass: Exception when called with different field orders

2020-05-27 Thread Darrick Yee


New submission from Darrick Yee :

https://docs.python.org/3/library/dataclasses.html#module-dataclasses

`make_dataclass` takes a `field` parameter, which is an iterable whose entries 
may be tuples of `(name, type)` or `(name, type, dataclasses.Field)`.  However, 
an exception is thrown if such tuples are provided in a particular order.  
Example:


from dataclasses import field, make_dataclass

fieldspec1 = ('field1', str)
fieldspec2 = ('field2', str, field(default='Hello'))

MyDc1 = make_dataclass('MyDc1', [fieldspec1, fieldspec2]) # Ok
MyDc2 = make_dataclass('MyDc2', [fieldspec2, fieldspec1]) # TypeError

I am guessing this is not intentional...

--
messages: 370112
nosy: Darrick Yee
priority: normal
severity: normal
status: open
title: dataclasses.make_dataclass: Exception when called with different field 
orders
type: behavior
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



[issue40667] [Windows] Add global python and python3 commands

2020-05-27 Thread Steve Dower


Steve Dower  added the comment:

After thinking this through some more, I don't think this solves the problem, 
but only changes it. And we're better off leaving things as they are than just 
moving them around.

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



[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-27 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

We consider it closer to new feature as it changes existing behavior in a way 
that people cannot _depend_ on being present in older Python releases as it'd 
only appear in a bugfix release, so most people could never write code 
depending on it while claiming to generally support 3.7-3.9.

Anyways your PR overall looks good for 3.10.  I left some comments.

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-27 Thread hai shi


Change by hai shi :


--
pull_requests: +19712
pull_request: https://github.com/python/cpython/pull/20459

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Christian Heimes


Christian Heimes  added the comment:

GPS, I got you covered :)

CRYPTO_memcmp() was on my TODO list for a while. Thanks for nagging me.

_operator is a built-in module. I don't want to add libcrypto dependency to 
libpython. I copied the code, made some adjustments and added it to 
_hashopenssl.c.

--

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +19711
pull_request: https://github.com/python/cpython/pull/20456

___
Python tracker 

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



[issue2897] Deprecate structmember.h

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

> Note that structmember.h pollutes global namespace with macros that do not 
> have conventional Py_ or PY_ prefix.  READONLY and RESTRICTED macros seem to 
> be most likely to conflict with other code.

One small enhance would be to add such prefix when Py_LIMITED_API is defined.

--

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Christian - Devin could likely use some help with the build/ifdef plumbing 
required for (2) to use CRYPTO_memcmp from Modules/_operator.c when OpenSSL is 
available.

--
assignee:  -> christian.heimes

___
Python tracker 

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



[issue2897] PyMemberDef missing in limited API / Deprecate structmember.h

2020-05-27 Thread Matthias Braun


Matthias Braun  added the comment:

Happy to take the proposed diff here (assuming @belopolsky wont mind) and 
include it into a pull request that also renames the uses of the READONLY flags 
(and maybe removes the RESTRICTED flags) within cpython source itself.

--

___
Python tracker 

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



[issue2897] PyMemberDef missing in limited API / Deprecate structmember.h

2020-05-27 Thread Matthias Braun


Change by Matthias Braun :


--
title: Deprecate structmember.h -> PyMemberDef missing in limited API / 
Deprecate structmember.h

___
Python tracker 

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



[issue2897] Deprecate structmember.h

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

Also, the bare minimum enhancement would be add rename READONLY to PY_READONLY, 
but keep a deprecated alias READONLY to PY_READONLY, and update CPython code 
base to use PY_READONLY. (Same for other similar flags.)

--

___
Python tracker 

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



[issue13097] [easy C issue] ctypes: segfault with large number of callback arguments

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Meador Inge for the bug report and thanks Sean Gillespie for the fix! It 
just took 9 years to fix this corner case ;-)

Copy of the comment on the PR:
https://github.com/python/cpython/pull/19914#pullrequestreview-419331432

I tried to rewrite _ctypes_callproc() to use PyMem_Malloc() instead of 
alloca(), but it's quite complicated. There are 3 arrays with a length of 
argcount items: args, avalues, atypes. Moreover, resbuf is also allocated with 
alloca(). When using PyMem_Malloc(), error handling is much more complicated.

I also tried to restrict the overall usage of stack memory to 4096 bytes (size 
of one page on x86), but users would be surprised by CTYPES_MAX_ARGCOUNT value.

I would say that raising an exception is better than crashing for a lot of 
arguments. If someone is blocked by this new limitation, in that case we can 
revisit the PyMem_Malloc() idea.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.7, Python 3.8, Python 3.9 -Python 2.7, Python 
3.2, Python 3.3

___
Python tracker 

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



[issue13097] [easy C issue] ctypes: segfault with large number of callback arguments

2020-05-27 Thread miss-islington


miss-islington  added the comment:


New changeset a285af7e626d1b81cf09f8b2bf7656f100bc1237 by Miss Islington (bot) 
in branch '3.8':
bpo-13097: ctypes: limit callback to 1024 arguments (GH-19914)
https://github.com/python/cpython/commit/a285af7e626d1b81cf09f8b2bf7656f100bc1237


--

___
Python tracker 

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



[issue2897] Deprecate structmember.h

2020-05-27 Thread Matthias Braun


Matthias Braun  added the comment:

> The issue title is misleading, it says "Deprecate structmember.h". Is the 
> plan still to deprecate it? Or to make it usable in the limited C API? Please 
> update the title.

As far as I understand it: The attached diff, moves the interesting declaration 
to `object.h` solving the limited API problem. And only leaves structmember.h 
around for backward compatibility for people using the "old" names `READONLY` 
or `RESTRICTED`. So in that sense it does deprecate structmember.h

But indeed I hijacked this issue with my complaints about the limited API which 
may not have been the original intention here, but they get solved nonetheless.

--

___
Python tracker 

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



[issue13097] [easy C issue] ctypes: segfault with large number of callback arguments

2020-05-27 Thread miss-islington


miss-islington  added the comment:


New changeset 1c4dcafd0b025e771f4dbd7197d0b5f263c9cb54 by Miss Islington (bot) 
in branch '3.7':
bpo-13097: ctypes: limit callback to 1024 arguments (GH-19914)
https://github.com/python/cpython/commit/1c4dcafd0b025e771f4dbd7197d0b5f263c9cb54


--

___
Python tracker 

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



[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 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



[issue2897] Deprecate structmember.h

2020-05-27 Thread STINNER Victor


STINNER Victor  added the comment:

> The proposed patch here, would fix this!

The issue title is misleading, it says "Deprecate structmember.h". Is the plan 
still to deprecate it? Or to make it usable in the limited C API? Please update 
the title.

--

___
Python tracker 

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



[issue13097] [easy C issue] ctypes: segfault with large number of callback arguments

2020-05-27 Thread miss-islington


miss-islington  added the comment:


New changeset 788d7bfe189e715eab3855c20ea5d6da0d8bed70 by Miss Islington (bot) 
in branch '3.9':
bpo-13097: ctypes: limit callback to 1024 arguments (GH-19914)
https://github.com/python/cpython/commit/788d7bfe189e715eab3855c20ea5d6da0d8bed70


--

___
Python tracker 

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



[issue2897] Deprecate structmember.h

2020-05-27 Thread Matthias Braun


Change by Matthias Braun :


--
components: +C API
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



[issue2897] Deprecate structmember.h

2020-05-27 Thread Matthias Braun


Matthias Braun  added the comment:

This wasn't mentioned before: Having PyMemberDef part of the structmember.h is 
a big problem for users of PEP384/limited API, because structmember.h is not 
part of it.

Which results in the odd situation that `Py_tp_members` or 
`PyDescr_NewMember()` are part of the limited API but technically you cannot 
use it because you are not supposed to include headers that are not part of 
`Python.h`.

The proposed patch here, would fix this!

--
nosy: +Matthias Braun

___
Python tracker 

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



[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

You can do this as part of your mega-PR to turn on `from __future__ import 
annotations` by default.

--

___
Python tracker 

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



[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

(I applied it to my own branch, don't know if a seperate PR needed)

--

___
Python tracker 

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



[issue40794] dataclass signatures and docstrings w/future-annotations

2020-05-27 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

I have applied Guido's suggestion and it looks like it is working.

--

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

+1 for both of these suggestions

--
nosy: +rhettinger
type:  -> security
versions:  -Python 3.5, Python 3.6

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +christian.heimes, gregory.p.smith

___
Python tracker 

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



  1   2   >