[issue44423] copy2 / sendfile fails on linux with large file

2021-06-14 Thread karl


New submission from karl :

by copy a large file e.g.

-rwxrwxr-x 1 1002 1001 5359338160 Feb  9  2019 xxx_file_xxx.mdx

copy2 / sendfile / fastcopy fails with:


Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
  File "/usr/local/lib/python3.8/dist-packages/pybcpy/diff_bak_copy.py", line 
212, in _init_copy_single
shutil.copy2(f, dest_path)
  File "/usr/lib/python3.8/shutil.py", line 432, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.8/shutil.py", line 272, in copyfile
_fastcopy_sendfile(fsrc, fdst)
  File "/usr/lib/python3.8/shutil.py", line 169, in _fastcopy_sendfile
raise err
  File "/usr/lib/python3.8/shutil.py", line 149, in _fastcopy_sendfile
sent = os.sendfile(outfd, infd, offset, blocksize)
OSError: [Errno 75] Value too large for defined data type: 'xxx_file_xxx.mdx' 
-> 'dest/xxx_file_xxx.mdx'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
  File "/usr/local/lib/python3.8/dist-packages/pybcpy/__main__.py", line 433, 
in 
main_func()
  File "/usr/local/lib/python3.8/dist-packages/pybcpy/__main__.py", line 425, 
in main_func
args.func(args)
  File "/usr/local/lib/python3.8/dist-packages/pybcpy/__main__.py", line 75, in 
cmd_init
) = dbak.init_backup_repo(tarmode=args.tar)
  File "/usr/local/lib/python3.8/dist-packages/pybcpy/diff_bak_copy.py", line 
231, in init_backup_repo
files = p.map(self._init_copy_single, ifiles)
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 771, in get
raise self._value
OSError: [Errno 75] Value too large for defined data type: 'xxx_file_xxx.mdx' 
-> 'dest/xxx_file_xxx.mdx'


reference to code:
https://github.com/kr-g/pybcpy/blob/master/pybcpy/diff_bak_copy.py

--
messages: 395862
nosy: kr-g
priority: normal
severity: normal
status: open
title: copy2 / sendfile fails on linux with large file
type: crash
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



[issue44365] Bad dataclass post-init example

2021-06-14 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

How about this example:

@dataclass
class Rect:
x: int
y: int

r=Rect(5,2)

@dataclass
class HyperRect(Rect):
z: int

def __post_init__(self):
self.vol = self.x*self.y*self.z

hr=HyperRect(5,2,3)
print("hr.vol", hr.vol)

Hyper Rectangle:
https://en.wikipedia.org/wiki/Hyperrectangle

--
nosy: +andrei.avk

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2021-06-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

[Victor Stinner]
> My plan is to merge changes which have no significant
> impact on performances

FWIW, PyFloat_FromDouble() is the most performance critical function in 
floatobject.c.

--

___
Python tracker 

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



[issue25682] __package__ not set to None under pdb in Python 3

2021-06-14 Thread Irit Katriel


Irit Katriel  added the comment:

Thanks Keith. Closing and we can look into it if someone else has an issue.

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



[issue37880] For argparse add_argument with action='store_const', const should default to None.

2021-06-14 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> vinay.sajip
nosy: +vinay.sajip

___
Python tracker 

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



[issue25682] __package__ not set to None under pdb in Python 3

2021-06-14 Thread Keith Prussing


Keith Prussing  added the comment:

Caveat: It's been a few years so I'm trying to recall what I was doing at the 
time and what my original problem was.

I understand and expect pdb to populate __package__ and __main__ to be what it 
expects when run as a module with -m.  However, I believe my expectation was 
for it to not alter the relevant __package__ or __main__ with respect to the 
script being debugged.  This was the behavior in Python 2.7 which changed 
(unexpectedly to me) in Python 3.4 (or earlier.  I obviously didn't look too 
hard).  I must have been trying to debug a script that expected to run using 
the -m option but could be run as a script too.

A few things have changed since the original report:

1.  I have forgotten which script/tool I was working on so I wouldn't be able 
to find it if I tried.
2.  I was trying to support Python 2.7 and Python 3 (which I have 0 interest in 
doing ever again),
3.  This small gotcha apparently hasn't tripped up anyone else.

At this point, I suspect this has been overcome by events and can be closed.

--

___
Python tracker 

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



[issue44420] Add CapWords classes to datetime module?

2021-06-14 Thread Douglas Thor


Douglas Thor  added the comment:

Thanks for the info!

Rejecting issue, as it would not be feasible to maintain going forward.

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

___
Python tracker 

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



[issue44420] Add CapWords classes to datetime module?

2021-06-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

I suggest you close it. If you want some broader discussion, you should bring 
it up on the python-ideas mailing list, but I don't expect you'll get much 
support.

--

___
Python tracker 

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



[issue44420] Add CapWords classes to datetime module?

2021-06-14 Thread Douglas Thor


Douglas Thor  added the comment:

Thanks for correcting the version selection.

> the old names could never be removed ... it's not worth the hassle

I had the same thought, so I spent a lot of time trying to come up with 
"Benefits", haha.

I'm OK with this being closed as rejected.
Is there a standard procedure for doing so? Eg: "keep things open for at least 
24hrs so that multiple people can see things" or "only members of  should 
close issues"? If not I'll just close it myself.

--

___
Python tracker 

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



[issue44421] random.uniform() hangs will eating up all available RAM

2021-06-14 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Hi Christian,

For future reference, here are some good guidelines for submitting bug reports 
and asking for help to debug your code:

https://stackoverflow.com/help/minimal-reproducible-example

http://www.sscce.org/

--
nosy: +steven.daprano

___
Python tracker 

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



[issue41930] Wrap sqlite3_serialize API in sqlite3 module

2021-06-14 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> What would be the use case for this?

Quoting D. Richard Hipp, from the sqlite-users mailing list, 2018-03-18, FWIW:
  These APIs support the concept of using small databases (small enough 
  to fit in memory) as a container for passing information around. 

  For example:  A client program might communicate with a server using 
  an HTTP request and sending an SQLite database as the POST data.  Or 
  the server might send an SQLite database as the reply.  [...]

  Advantages of using an SQLite database as a container: 

  (1) It is easy to mix text and binary data without having to worry 
  with encodings. 

  (2) Applications can be easily enhanced and extended in 
  backwards-compatible ways by adding new columns and/or tables. 

  (3) Easy to manually view or modify the container content during 
  testing and debugging. (JSON also has this property, but JSON does not 
  work with binary data.) 

  (4) No need to write encoder/decoder logic. 

  (5) There is a high-level query language available to extract the 
  content in an order that might be very different from the order it 
  appears in the file. 

  (6) No need to worry with big-endian vs. little-endian translation, 
  nor UTF8 vs UTF16.  The database handles that automatically.


Using the serialise/deserialise API's to pickle an in-memory database to a data 
stream is an interesting thought.

--

___
Python tracker 

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



[issue31643] test_uuid: test_getnode and test_windll_getnode fail if connected to the Internet via an Android phone

2021-06-14 Thread Irit Katriel


Change by Irit Katriel :


--
keywords:  -patch
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue41930] Wrap sqlite3_serialize API in sqlite3 module

2021-06-14 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue44422] threading.enumerate(): reentrant call during a GC collection hangs

2021-06-14 Thread STINNER Victor


STINNER Victor  added the comment:

There are different ways to fix this issue:

* (A) Rewrite threading.enumerate() in C with code which cannot trigger a GC 
collection
* (B) Disable temporarily the GC
* (C) Use a reentrant lock (PR 26727)

(A) The problem is that functions other than threading.enumerate() 
also rely on this lock, like threading.active_count(). I would prefer to not 
have to rewrite "half" of threading.py in C. Using a RLock is less intrusive.

(B) This is a simple and reliable option. But gc.disable() is process-wide: it 
affects all Python threads, and so it might have surprising side effects. Some 
code might rely on the current exact GC behavior. I would prefer to not disable 
the GC temporarily.

--

___
Python tracker 

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



[issue44422] threading.enumerate(): reentrant call during a GC collection hangs

2021-06-14 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue44422] threading.enumerate(): reentrant call during a GC collection hangs

2021-06-14 Thread STINNER Victor


New submission from STINNER Victor :

The threading.enumerate() code is simple:
---
# Active thread administration
_active_limbo_lock = _allocate_lock()
_active = {}# maps thread id to Thread object
_limbo = {}

def enumerate():
with _active_limbo_lock:
return list(_active.values()) + list(_limbo.values())
---

values(), list() and list+list operations can call trigger a GC collection 
depending on the GC thresholds, created Python objects, etc.

During a GC collection, a Python object destructor (__del__) can again call 
threading.enumerate().

Problem: _active_limbo_lock is not re-entrant lock and so the second call hangs.

In practice, this issue was seen in OpenStack which uses eventlet, when a 
destructor uses the logging module. The logging module uses 
threading.current_thread(), but this function is monkey-patched by the eventlet 
module.

Extract of the eventlet function:
---
def current_thread():
...
found = [th for th in __patched_enumerate() if th.ident == g_id]
...
---
https://github.com/eventlet/eventlet/blob/master/eventlet/green/threading.py

Attached PR makes _active_limbo_lock re-entrant to avoid this issue. I'm not 
sure if it's ok or not, I would appreciate to get a review and your feedback ;-)

Attached file triggers the threading.enumerate() hang on re-entrant call.

--
components: Library (Lib)
files: rec_threading.py
messages: 395851
nosy: vstinner
priority: normal
severity: normal
status: open
title: threading.enumerate(): reentrant call during a GC collection hangs
versions: Python 3.10, Python 3.11, Python 3.9
Added file: https://bugs.python.org/file50110/rec_threading.py

___
Python tracker 

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



[issue44421] random.uniform() hangs will eating up all available RAM

2021-06-14 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue44421] random.uniform() hangs will eating up all available RAM

2021-06-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur with Jack. There is no evidence of a bug in Python itself and it is 
not reasonable to ask us the study and debug your obfuscated code.

I just ran random.uniform() in a tight loop for several minutes and observed no 
deleterious effects.  Am marking this as closed as not being a bug.

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



[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-14 Thread Eryk Sun


Eryk Sun  added the comment:

>> Try changing EnterNonRecursiveMutex() to break out of the loop in 
>> this case
>
> This does work, but unfortunately a little too well - in a single 
> test I saw several instances where that approach returned 
> _earlier_ than the timeout.

It's documented that a timeout between N and N+1 ticks can be satisfied 
anywhere in that range. In practice I see a wider range. In the kernel, 
variations in wait time could depend on when the due time is calculated in the 
interrupt cycle, when the next interrupt occurs and the interrupt time is 
updated, and when the thread is dispatched. A benefit of using a 
high-resolution external deadline is that waiting will never return early, but 
it may return later than it otherwise would, e.g. if re-waiting for a remaining 
1 ms actually takes 20 ms.

There are many unrelated WaitForSingleObject and WaitForMultipleObjects in the 
interpreter, extension modules, and code that uses _winapi.WaitForSingleObject 
and _winapi.WaitForMultipleObjects. For example, time.sleep() allows 
WAIT_TIMEOUT to override the deadline. I suggest measuring the 
performance-counter interval for time.sleep(0.001) on both the main thread 
(Sleep based) and a new thread (WaitForSingleObjectEx based).

--

___
Python tracker 

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-14 Thread STINNER Victor


STINNER Victor  added the comment:

> My read is that as long as we're not confident enough to remove those checks 
> from pytime.c, a caller should assume they're reachable. If the pytime checks 
> need to stay, adding a Windows only pytime init check to make sure that locks 
> won't deadlock sounds fine to me.

If you consider that the risk is non-zero, you can add a check at startup.

Do you expect that a startup check is enough, or do you expect failures later?

I understood that if the first call succeed, later calls are very unlikely to 
fail. The first call should be enough to check for all possible errors.

--

___
Python tracker 

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



[issue7089] shlex behaves unexpected if newlines are not whitespace

2021-06-14 Thread Irit Katriel


Irit Katriel  added the comment:

I've reproduced on 3.11.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue7089] shlex behaves unexpected if newlines are not whitespace

2021-06-14 Thread Irit Katriel


Change by Irit Katriel :


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



[issue29799] Add tests for header API of 'urllib.request.Request' class

2021-06-14 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as this seems abandoned. Please reopen or create a new issue if you 
would like to continue working on it.

--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue3014] file_dealloc() assumes errno is set when EOF is returned

2021-06-14 Thread Irit Katriel


Change by Irit Katriel :


--
stage: patch review -> resolved
status: pending -> closed

___
Python tracker 

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



[issue31248] method wrapper type has invalid __name__/__qualname__ 'method-wrapper'

2021-06-14 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as it's not clear what the problem is. Please reopen or create a new 
issue if you can explain.

--
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue31289] File paths in exception traceback resolve symlinks

2021-06-14 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as there doesn't seem to be interest in this currently. If you would 
like to pursue it, please bring it up for discussion on python-ideas. The 
semantics you request are not the only obvious option, so this needs to be 
agreed.

--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue44342] enum with inherited type won't pickle

2021-06-14 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +25316
pull_request: https://github.com/python/cpython/pull/26726

___
Python tracker 

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



[issue44421] random.uniform() hangs will eating up all available RAM

2021-06-14 Thread Jack DeVries


Jack DeVries  added the comment:

This doesn't look like a bug. It's hard to disentangle what your code is doing, 
exactly, but it's most likely that between all your nested loops and classes 
initializing each other, there is an exponential or greater growth in time 
complexity happening. As your input values grow, the program slows down at an 
exponential rate until it appears to just "hang".

The RAM is growing because the program hasn't really stopped running, it's just 
dutifully chugging along and filling up more and more memory, and if you waited 
long enough the program would either crash having run out of memory or maybe 
the program would complete in a very, very long time.

I hope I'm not missing something; feel free to let me know, or share a more 
minimal example to reproduce the issue.

--
nosy: +jack__d

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread STINNER Victor


STINNER Victor  added the comment:

> https://github.com/dgrunwald/rust-cpython/blob/b63d691addc978952380a8eb146d01a444e16e7a/src/objects/capsule.rs

A friend explained me that it's a doctest and unicodedata.ucnhash_CAPI was 
picked as an example, but any other capsule could be used to test the Capsule 
API of rust-cpython. rust-cpython doesn't use unicodedata.ucnhash_CAPI.

--

___
Python tracker 

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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Can we remove this from the stable API during beta?

It was added (to PC/python3.def) in 3.9, so removing in 3.10 beta wouldn't be 
good.
It can be deprecated; should it?

--

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2021-06-14 Thread Jack DeVries


Change by Jack DeVries :


--
pull_requests:  -25270

___
Python tracker 

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-14 Thread Ethan Furman


Ethan Furman  added the comment:

Yup, just had to get back from the weekend.  :-)

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread Miro Hrončok

Miro Hrončok  added the comment:

Updating the doctest is certainly a good solution for this particular project. 
However I still think this regression deserves to be resolved. This was part of 
the API, whether intended or not.

--

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Sounds like an easy solution is to open an issue/PR against rust-cpython to 
update the doctest, IMO.

--

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2021-06-14 Thread Jack DeVries


Change by Jack DeVries :


--
nosy:  -jack__d

___
Python tracker 

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



[issue44369] Improve syntax error for wrongly closed strings

2021-06-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

One problem with that is that the lookahead will move the error indicator to 
some incorrect place if the match fails. For example:

PYTHON3.9

>>> "dfssdfsdfsd" fdsf sdfsdfsd {}
  File "", line 1
"dfssdfsdfsd" fdsf sdfsdfsd {}
  ^
SyntaxError: invalid syntax

with this PR:

>>> "dfssdfsdfsd" fdsf sdfsdfsd {}
  File "", line 1
"dfssdfsdfsd" fdsf sdfsdfsd {}
^
SyntaxError: invalid syntax

We need a solution to this problem first

--

___
Python tracker 

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



[issue44421] random.uniform() hangs will eating up all available RAM

2021-06-14 Thread Christian Kleineidam


New submission from Christian Kleineidam :

I'm writing a model that needs a lot of random numbers. The model counts up to 
"Year:640: Count:1339" (taking around two minutes) and then hangs on 
random.uniform(0, 1). While it hangs, the amount of RAM python takes grows till 
it eats up all available RAM with RAM usage growing by around 100 MB per second.

I'm running Windows 10 and the error appears in both Python 3.8.8 as well as in 
3.9.5. I'm attaching a file that reproduces the error. 

File "C:\Users\Christian\folder\obfuscated.py", line 427, in 
population = population.next()

  File "C:\Users\Christian\folder\obfuscated.py", line 385, in next
return Class4(self.nextClass4)

  File "C:\Users\Christian\folder\obfuscated.py", line 280, in __init__
var42.var30()

  File "C:\Users\Christian\folder\obfuscated.py", line 177, in var30
var22.var30(self.var17,self.var18,self.var21)

  File "C:\Users\Christian\folder\obfuscated.py", line 100, in var30
self.barClass1s.append(var23.child())

  File "C:\Users\Christian\folder\obfuscated.py", line 29, in child
if var6>random.uniform(0, 1):

  File "C:\Progs\anaconda3\lib\random.py", line 417, in uniform
return a + (b-a) * self.random()

--
components: Library (Lib)
files: obfuscated.py
messages: 395836
nosy: Christian.Kleineidam
priority: normal
severity: normal
status: open
title: random.uniform() hangs will eating up all available RAM
versions: Python 3.9
Added file: https://bugs.python.org/file50109/obfuscated.py

___
Python tracker 

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-14 Thread Ryan Hileman


Ryan Hileman  added the comment:

> Do you think that pytime.c has the bug? I don't think so.

No, a misaligned stack would be an issue in the caller or compiler, not 
pytime.c. I have hit misaligned stack in practice, but it should be rare enough 
to check on init only.

> In theory yes, in practice we got zero error reports. So it sounds like it 
> cannot happen.
> I don't think that it's a good practice to start to add checks in all 
> functions using a clock "just in case" the clock might fail.

My read is that as long as we're not confident enough to remove those checks 
from pytime.c, a caller should assume they're reachable. If the pytime checks 
need to stay, adding a Windows only pytime init check to make sure that locks 
won't deadlock sounds fine to me.

--

___
Python tracker 

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



[issue44420] Add CapWords classes to datetime module?

2021-06-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

Changing versions: this could only be added to 3.11.

I think the ship has sailed on this. The old names could never be removed so 
we'd have to support both names forever. I think it's not worth the hassle.

--
nosy: +eric.smith
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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Ken Jin


Ken Jin  added the comment:

(Copied over from the PR)

BTW, I also noticed the stable ABI manifest exposes the wrong return type for 
Py_GenericAliasType. It exposes it as a function when it's a var/type/struct. 
So I fixed that in the PR too otherwise the docs weren't compiling (I can split 
that into a separate PR if needed). But that means the exported symbol for 
Windows is also modified.

--

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-06-14 Thread Mark Dickinson


Change by Mark Dickinson :


--
pull_requests: +25315
pull_request: https://github.com/python/cpython/pull/26725

___
Python tracker 

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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Guido van Rossum


Guido van Rossum  added the comment:

Maybe the docs then should contain a more-or-less complete example showing how 
a 3rd party type should use this?

--

___
Python tracker 

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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Ken Jin


Ken Jin  added the comment:

> maybe it was a mistake to expose this

I was wondering if this was accidentally added at the time too.

> Remind me what use is made of this from C code

It's required for a C extension type to implement the __class_getitem__ method 
properly. Eg. ``MyCType[int]``. The other alternative is for them to import the 
types.GenericAlias Python constructor and call that, but that seems strange.

> Can we remove this from the stable API during beta? It was never exposed 
> before.

Unfortunately, it seems like it has been (accidentally?) exposed since 3.9 :(. 
I see some 3rd party projects using it already, so I don't know if we can get 
rid of it so easily:
https://github.com/Nuitka/Nuitka/blob/57fecfe6cc939f4694b57d2efa37d1893c06b85b/nuitka/build/include/nuitka/helper/subscripts.h#L97

CC-ing Petr, seeking advice on the C stable ABI for this please.

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue34025] SMTP EmailPolicy not using the correct line length for RCF 2045 encoded data (is 78, should be 76)

2021-06-14 Thread Douglas Thor


Change by Douglas Thor :


--
nosy:  -Douglas Thor

___
Python tracker 

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



[issue34025] SMTP EmailPolicy not using the correct line length for RCF 2045 encoded data (is 78, should be 76)

2021-06-14 Thread Douglas Thor


Change by Douglas Thor :


--
nosy: +dougthor42

___
Python tracker 

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



[issue44420] Add CapWords classes to datetime module?

2021-06-14 Thread Douglas Thor


New submission from Douglas Thor :

Has there been any discussion on adding CapWords class names to the datetime.py 
module?

I searched through the bug tracker ("CapWords" and "CamelCase") and didn't find 
anything, but perhaps I'm not searching for the correct keywords.

Eg:

```
# datetime.py
class datetime:
...

class tzinfo:
...

...

DateTime = datetime
TzInfo = tzinfo
TimeZone = timezone
TimeDelta = timedelta
...
```


I'd imaging implementing this would be pretty trivial and wouldn't break any 
existing functionality. I'd be happy to implement it.


Benefits:
+ Starts down the road to naming conventions found in pep8.
+ Maybe makes discovery easier for new users? It can be confusing for new users 
when the same word "datetime" can refer to either a class or a module.
+ Can start a deprecation process for the all-lowercase class names if so 
desired (actually doing so is outside the scope of this discussion)
+ Makes it easy, at a glance, to tell if code is referring to `datetime` the 
module or `DateTime` the class.


Downsides:
- fragments future usage: there will be a split between people using `DateTime` 
and `datetime`. This makes it hard to do things like mass grep over codebase.
- "If it ain't broke, don't fix it"
- ???

--
components: Library (Lib)
messages: 395830
nosy: dougthor42
priority: normal
severity: normal
status: open
title: Add CapWords classes to datetime module?
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

They'd still need runtime support from GenericAlias to allow users to write 
`numpy.ndarray[int]` at runtime.

--

___
Python tracker 

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



[issue44402] Python 3.9 and 3.10 fails to install in WINE

2021-06-14 Thread Steve Dower


Steve Dower  added the comment:

WINE is not a platform that we officially support, and for the installer, I'm 
willing to say that we never will.

Our installer is based on the WiX Toolset, so anything that can be fixed will 
have to be fixed by them first. It's possible that they have already fixed 
whatever broke between those releases and we just need to update the version 
we're using, but a detailed report is not going to help us as we don't control 
that code.

If you download the package from https://www.nuget.org/packages/python/ (either 
using the Nuget CLI tool or directly from the page), you should be able to just 
extract and run it on WINE (at least as well as WINE can support it, which is 
up to them rather than us, but at least any specific issues in CPython we can 
work around if necessary).

--
resolution:  -> third party
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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Guido van Rossum

Guido van Rossum  added the comment:

Hm, but is that what they are doing? I assume that they use stub files, since 
static type checkers don’t introspect the runtime API.

--

___
Python tracker 

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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

It could be useful for C extensions that want to support PEP 585 for their 
types, such as numpy's array type.

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue44419] Wrong division calculation for numbers more than 16 digits

2021-06-14 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Also please read this:

https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate

--
nosy: +steven.daprano

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread STINNER Victor


STINNER Victor  added the comment:

If we decide to restore the C API to the Python 3.9 C API, *all* changes done 
in the unicodedata in Python 3.10 should be reverted, since early changes 
already changed/broke the C API, and following changes rely on that.

--

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread Miro Hrončok

Miro Hrončok  added the comment:

> Does it mean that rust-cpython was broken in Python 3.10 even if a change was 
> prepared with a deprecation period if Python 3.9? Does it mean that the 
> deprecation period was inefficient on this project?

I don't see any deprecation warning when running the test suite with Python 3.9 
and I am unsure what exactly changed there. My assumption is that it might be 
related to PyNumber_Long not taking floats any more and I am unsure that this 
particular thing omitted deprecation warnings. Still investigating.

--

___
Python tracker 

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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Guido van Rossum


Guido van Rossum  added the comment:

Hm, maybe it was a mistake to expose this? Remind me what use is made of this 
from C code? Can we remove this from the stable API during beta? It was never 
exposed before.

--
nosy: +Guido.van.Rossum

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread STINNER Victor


STINNER Victor  added the comment:

> (Note that there are also other failures regarding an implicit float->int 
> conversion, but they seem to be caused by a change that followed the 
> deprecation period.)

Does it mean that rust-cpython was broken in Python 3.10 even if a change was 
prepared with a deprecation period if Python 3.9? Does it mean that the 
deprecation period was inefficient on this project?

--

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread STINNER Victor


STINNER Victor  added the comment:

The UCD_Check() issue was discussed in Mohamed Koubaa's PRs:

* https://github.com/python/cpython/pull/22145 (closed) <= HERE
* https://github.com/python/cpython/pull/22328 (merged)
* https://github.com/python/cpython/pull/22490 (closed)

--

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread Miro Hrončok

Miro Hrončok  added the comment:

All details I have about rust-cpython are that it fails tests with:

AttributeError: module 'unicodedata' has no attribute 'ucnhash_CAPI'

See the test failures in https://koschei.fedoraproject.org/package/rust-cpython 
e.g.:

 src/objects/capsule.rs - objects::capsule::PyCapsule (line 34) stdout 
Test executable failed (exit code 101).
stderr:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PyErr { 
ptype: , pvalue: Some(AttributeError("module 
'unicodedata' has no attribute 'ucnhash_CAPI'")), ptraceback: None }', 
src/objects/capsule.rs:77:2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 src/objects/capsule.rs - py_capsule (line 232) stdout 
Test executable failed (exit code 101).
stderr:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PyErr { 
ptype: , pvalue: Some(AttributeError("module 
'unicodedata' has no attribute 'ucnhash_CAPI'")), ptraceback: None }', 
src/objects/capsule.rs:73:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
src/objects/capsule.rs - objects::capsule::PyCapsule (line 34)
src/objects/capsule.rs - py_capsule (line 232)

(Note that there are also other failures regarding an implicit float->int 
conversion, but they seem to be caused by a change that followed the 
deprecation period.)

--

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-14 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



[issue44417] bytecode<>line number mapping and f_lasti seem wrong in 3.10.0b2

2021-06-14 Thread Gabriele N Tornetta


Gabriele N Tornetta  added the comment:

I think I managed to find the source of the confusion. This seems to be due to 
https://github.com/python/cpython/commit/fcb55c0037baab6f98f91ee38ce84b6f874f034a,
 with the f_lasti from the C struct now being half of the value returned by the 
f_lasti attribute of the frame object (is this documented somewhere?).

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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Ken Jin


Change by Ken Jin :


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

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread STINNER Victor


STINNER Victor  added the comment:

> This breaks at least https://github.com/dgrunwald/rust-cpython

When I search for "ucnhash_CAPI" in the GitHub search, I only find commented 
code:

https://github.com/dgrunwald/rust-cpython/blob/b63d691addc978952380a8eb146d01a444e16e7a/src/objects/capsule.rs

Does rust-cpython generate code? Do you have more details about the error? How 
does it use unicodedata.ucnhash_CAPI?

--

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread STINNER Victor


STINNER Victor  added the comment:

Oh, I forgot about this issue. Let me rebuild the context.

Copy of the What's New in Python 3.10 entry:

"Removed the unicodedata.ucnhash_CAPI attribute which was an internal PyCapsule 
object. The related private _PyUnicode_Name_CAPI structure was moved to the 
internal C API. (Contributed by Victor Stinner in bpo-42157.)"


The C API changes. Python <= 3.9:

typedef struct {

/* Size of this struct */
int size;

/* Get name for a given character code.  Returns non-zero if
   success, zero if not.  Does not set Python exceptions.
   If self is NULL, data come from the default version of the database.
   If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */
int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen,
   int with_alias_and_seq);

/* Get character code for a given name.  Same error handling
   as for getname. */
int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code,
   int with_named_seq);

} _PyUnicode_Name_CAPI;

Python >= 3.10:

typedef struct {

/* Get name for a given character code.
   Returns non-zero if success, zero if not.
   Does not set Python exceptions. */
int (*getname)(Py_UCS4 code, char* buffer, int buflen,
   int with_alias_and_seq);

/* Get character code for a given name.
   Same error handling as for getname(). */
int (*getcode)(const char* name, int namelen, Py_UCS4* code,
   int with_named_seq);

} _PyUnicode_Name_CAPI;

Changes:

* _PyUnicode_Name_CAPI.size was removed
* getname and getcode functions have no more "self" argument

There was also a "void *state" parameter in commit 
https://github.com/python/cpython/commit/47e1afd2a1793b5818a16c41307a4ce976331649
 but it was removed later.


In Python, it's used in two places:

* unicodeobject.c: "\N{...}" format to get a code point by its name
* codecs.c: PyCodec_NameReplaceErrors(), "namereplace" error handler

Both used self=NULL in Python 3.9.


It was simpler to remove the C API rather than trying to keep backward 
compatibility. The problem was to support the "self" parameter.

See the comment:
---
// Check if self is an unicodedata.UCD instance.
// If self is NULL (when the PyCapsule C API is used), return 0.
// PyModule_Check() is used to avoid having to retrieve the ucd_type.
// See unicodedata_functions comment to the rationale of this macro.
#define UCD_Check(self) (self != NULL && !PyModule_Check(self))
---

In my PR, I wrote:

"I prefer to merge this early in the 3.10 dev cycle, to increase chances of 
getting early user feedback if this change breaks 3rd party applications.

Thanks for the review @methane. Usually, features require 2 Python release to 
be removed, with a deprecation first. But this specific case is really weird. I 
chose to remove it immediately. IMO it was exposed in public "by mistake", 
whereas a private attribute would be enough for internal usage."

https://github.com/python/cpython/pull/22994#issuecomment-716958371

--
nosy: +koubaa, methane

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 0d0a9eaa822658679cc2b65f125ab74bfd4aedfe by Pablo Galindo in 
branch '3.9':
[3.9] bpo-44409: Fix error location in tokenizer errors that happen during 
initialization (GH-26712). (GH-26723)
https://github.com/python/cpython/commit/0d0a9eaa822658679cc2b65f125ab74bfd4aedfe


--

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-14 Thread miss-islington


miss-islington  added the comment:


New changeset 133cddf76e8265536c584872351c191e3afd66a2 by Miss Islington (bot) 
in branch '3.10':
bpo-44409: Fix error location in tokenizer errors that happen during 
initialization (GH-26712)
https://github.com/python/cpython/commit/133cddf76e8265536c584872351c191e3afd66a2


--

___
Python tracker 

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



[issue44283] Add jump table for certain safe match-case statements

2021-06-14 Thread Brandt Bucher

Brandt Bucher  added the comment:

Also (because some of the people who might be interested are nosied on this 
issue), I’ve been working a bit on general performance benchmarks for our 
pattern-matching implementation:

https://github.com/brandtbucher/patmaperformance

I still need something that hits sequence patterns hard, but I think these will 
help give us a good baseline for measuring future perf work in this area.

(There’s also the perf script at the bottom of Lib/test/test_patma.py, but the 
test cases it runs on probably are much less representative of “real” code.)

--

___
Python tracker 

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



[issue25682] __package__ not set to None under pdb in Python 3

2021-06-14 Thread Irit Katriel


Irit Katriel  added the comment:

pdb imports the module with importlib, and populates __main__ with data from 
its spec, including the package. This doesn't contradict the fact that the 
python command line can have only one "-m".

What is the actual problem here?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-14 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +25313
pull_request: https://github.com/python/cpython/pull/26723

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 507ed6fa1d6661e0f8e6d3282764aa9625a99594 by Pablo Galindo in 
branch 'main':
bpo-44409: Fix error location in tokenizer errors that happen during 
initialization (GH-26712)
https://github.com/python/cpython/commit/507ed6fa1d6661e0f8e6d3282764aa9625a99594


--

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-14 Thread miss-islington


Change by miss-islington :


--
keywords: +patch
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +25312
pull_request: https://github.com/python/cpython/pull/26722

___
Python tracker 

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-14 Thread Jacob Walls


Jacob Walls  added the comment:

With the followup patch merged, can this be closed now?

--
nosy: +jacobtylerwalls

___
Python tracker 

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



[issue44283] Add jump table for certain safe match-case statements

2021-06-14 Thread Brandt Bucher

Brandt Bucher  added the comment:

Sorry, I’ve been out on vacation this weekend. I didn’t realize that there was 
already a PR for this… I’m honestly not sure that it’s totally ready yet.

While I absolutely agree that compiling efficient decision trees lies in our 
future, it certainly seems to me that using *both* strategies (decision trees 
and jump tables) would create the most efficient branching structure. In 
effect, our control flow would be a rose tree.

In your example, Mark, we could perform the checks for the integers 1 and 2 
simultaneously, right?

Or consider a slightly more complicated example (simplified from PEP 636):

match …:
case ["quit"]: …
case ["look"]: …
case ["get", obj]: …
case ["go", direction]: …

We could compile this to something like:

- Check for Sequence.
- Multi-way jump on length.
- Multi-way jump on first item.

…which looks ideal to me.

I’m also confident that the jumping ops could also be broken up into fairly 
primitive instructions. A multi-way branch would just look something like:

(subject on TOS)
LOAD_CONST()
ROT_TWO
BINARY_SUBSCR
JUMP_FORWARD_TOS

…where only JUMP_FORWARD_TOS is new.

> For a sequence of integer constants, introducing the test `type(x) == int` at 
> the start would allow you to convert the linear sequence of tests into a 
> tree. Reducing `n` tests to `ln(n) + 1` tests.

Sorry, I’m having a bit of difficulty following this part. Is it something like 
the strategy I just described?

--

___
Python tracker 

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



[issue42387] Pdb should restore the execution environment before reexecuting the target

2021-06-14 Thread Irit Katriel


Irit Katriel  added the comment:

I recently fixed a bug where breakpoints were not saved properly between reruns 
of the program - the assumption there was that if you set a breakpoint you 
don't want to have to set it again and again. 

Similarly, how do you know that the change to sys.path was made by the program 
rather than by a user from the debugger prompt?

It is easy enough to reset the state (just start a new debugger session) but if 
you want to restart the program with the env as it currently is, and you can't, 
it can be very annoying to have to re-apply all your settings again.

--
nosy: +iritkatriel
type:  -> enhancement

___
Python tracker 

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



[issue44419] Wrong division calculation for numbers more than 16 digits

2021-06-14 Thread Zachary Ware


Zachary Ware  added the comment:

The `/` operator does true division, which means the result will be a `float` 
rather than an `int`.  When the resultant float is large enough, precision will 
be lost.

You can use the `//` operator for floor (integer) division, where the result 
will remain as an integer.

--
nosy: +zach.ware
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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread Miro Hrončok

Miro Hrončok  added the comment:

Right. Nevertheless, the reaming has effectively removed the old name.

--

___
Python tracker 

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



[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-06-14 Thread miss-islington


miss-islington  added the comment:


New changeset 7f021952b2debb51306f70ec96a94ecc7fbffc19 by Miss Islington (bot) 
in branch '3.9':
bpo-38291: Remove mention of typing.io and typing.re again (GH-26113)
https://github.com/python/cpython/commit/7f021952b2debb51306f70ec96a94ecc7fbffc19


--

___
Python tracker 

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



[issue35089] Remove typing.io and typing.re from documentation

2021-06-14 Thread miss-islington


miss-islington  added the comment:


New changeset 7f021952b2debb51306f70ec96a94ecc7fbffc19 by Miss Islington (bot) 
in branch '3.9':
bpo-38291: Remove mention of typing.io and typing.re again (GH-26113)
https://github.com/python/cpython/commit/7f021952b2debb51306f70ec96a94ecc7fbffc19


--

___
Python tracker 

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



[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-06-14 Thread miss-islington


miss-islington  added the comment:


New changeset fc310cb862ce0411bb5daed37f7f31b75647495b by Miss Islington (bot) 
in branch '3.10':
bpo-38291: Remove mention of typing.io and typing.re again (GH-26113)
https://github.com/python/cpython/commit/fc310cb862ce0411bb5daed37f7f31b75647495b


--

___
Python tracker 

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



[issue35089] Remove typing.io and typing.re from documentation

2021-06-14 Thread miss-islington


miss-islington  added the comment:


New changeset fc310cb862ce0411bb5daed37f7f31b75647495b by Miss Islington (bot) 
in branch '3.10':
bpo-38291: Remove mention of typing.io and typing.re again (GH-26113)
https://github.com/python/cpython/commit/fc310cb862ce0411bb5daed37f7f31b75647495b


--

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

It's not removed, it's renamed (by 84f7382215b9e024a5590454726b6ae4b0ca70a0, 
GH-22994, bpo-42157). You can access it using the '_ucnhash_CAPI' attribute.

--
nosy: +erlendaasland

___
Python tracker 

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



[issue35089] Remove typing.io and typing.re from documentation

2021-06-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25311
pull_request: https://github.com/python/cpython/pull/26721

___
Python tracker 

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



[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-06-14 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +25308
pull_request: https://github.com/python/cpython/pull/26720

___
Python tracker 

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



[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-06-14 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 8a76683cfb842e12b57f6d276839f6c68fd94e1a by Sebastian Rittau in 
branch 'main':
bpo-38291: Remove mention of typing.io and typing.re again (GH-26113)
https://github.com/python/cpython/commit/8a76683cfb842e12b57f6d276839f6c68fd94e1a


--

___
Python tracker 

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



[issue35089] Remove typing.io and typing.re from documentation

2021-06-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25309
pull_request: https://github.com/python/cpython/pull/26720

___
Python tracker 

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



[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-06-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25310
pull_request: https://github.com/python/cpython/pull/26721

___
Python tracker 

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



[issue35089] Remove typing.io and typing.re from documentation

2021-06-14 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 8a76683cfb842e12b57f6d276839f6c68fd94e1a by Sebastian Rittau in 
branch 'main':
bpo-38291: Remove mention of typing.io and typing.re again (GH-26113)
https://github.com/python/cpython/commit/8a76683cfb842e12b57f6d276839f6c68fd94e1a


--

___
Python tracker 

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



[issue44419] Wrong division calculation for numbers more than 16 digits

2021-06-14 Thread Abbas Baharforoosh


New submission from Abbas Baharforoosh :

Hi
For big numbers (more than about 16 digits), python wrong calculate division, 
but calculating mod (%) is correct.

I write a sample code of manual division in file.

Thanks

--
files: big_number.py
messages: 395798
nosy: abahar1996
priority: normal
severity: normal
status: open
title: Wrong division calculation for numbers more than 16 digits
versions: Python 3.9
Added file: https://bugs.python.org/file50108/big_number.py

___
Python tracker 

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



[issue44283] Add jump table for certain safe match-case statements

2021-06-14 Thread Mark Shannon


Mark Shannon  added the comment:

This is going in the wrong direction.

Rather than add more complex instructions for use only by pattern matching, we 
need to simplify the individual operations and re-use existing instructions.
That way pattern matching can benefit from the general performance improvements 
that we are making.


If you are serious about improving the performance of pattern matching, you 
need to do the following in the compiler:
1. Generate a decision tree.
2. Improve that decision tree so that fewer decisions are required.
3. Generate bytecode from that tree that uses lower level operations.

E.g.

match x:
case [1]:
A
case [2]:
B

The initial decision tree looks like:

if is_sequence(x):
if len(x) == 1:
if x[0] == 1:
A
if is_sequence(x):
if len(x) == 1:
if x[0] == 2:
B

which can be improved to:

if is_sequence(x):
if len(x) == 1:
if x[0] == 1:
A
elif x[0] == 2:
B

For a sequence of integer constants, introducing the test `type(x) == int` at 
the start would allow you to convert the linear sequence of tests into a tree. 
Reducing `n` tests to `ln(n) + 1` tests.

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue44310] Document that lru_cache uses hard references

2021-06-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 809c3faa032d32bc45a0fa54d0400fcbc42a618f by Miss Islington (bot) 
in branch '3.10':
bpo-44310:  Note that lru_cache keep references to both arguments and results 
(GH-26715) (GH-26716)
https://github.com/python/cpython/commit/809c3faa032d32bc45a0fa54d0400fcbc42a618f


--

___
Python tracker 

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



[issue44417] bytecode<>line number mapping and f_lasti seem wrong in 3.10.0b2

2021-06-14 Thread Mark Shannon


Mark Shannon  added the comment:

What does "seem wrong" mean?
What exactly is the problem?

--

___
Python tracker 

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



[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-06-14 Thread Sebastian Rittau


Sebastian Rittau  added the comment:

And I opened a second PR (for Python 3.11 only) to issue a deprecation warning 
when typing.io or typing.re gets imported.

--

___
Python tracker 

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



[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-06-14 Thread Sebastian Rittau


Change by Sebastian Rittau :


--
pull_requests: +25307
pull_request: https://github.com/python/cpython/pull/26719

___
Python tracker 

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



[issue44415] sys.stdout.flush and print() hanging

2021-06-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not know what are lib.logger.Log and lib.debugger.Tee, but I guess that 
lib.logger.Log() creates a logger which writes to sys.stdout, and 
lib.debugger.Tee() is a file-like object which writes to the specified file and 
to standard output.

Standard output of your program is not consumed, so your program writes to it 
until fill the buffer and then hangs. Add >/dev/null 2>/dev/null at the end of 
the command in cronjob to redirect stdout and stderr. This issue is not 
specific for Python, you can get the same issue with any program which outputs 
to stdout or stderr.

--

___
Python tracker 

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



[issue44417] bytecode<>line number mapping and f_lasti seem wrong in 3.10.0b2

2021-06-14 Thread Gabriele N Tornetta


Change by Gabriele N Tornetta :


--
title: bytecode<>line number mapping seems wrong in 3.10.0b2 -> bytecode<>line 
number mapping and f_lasti seem wrong in 3.10.0b2

___
Python tracker 

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



[issue44418] unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation

2021-06-14 Thread Miro Hrončok

New submission from Miro Hrončok :

In bpo-42157, the unicodedata.ucnhash_CAPI attribute was removed without 
deprecation. This breaks at least https://github.com/dgrunwald/rust-cpython 
with:

AttributeError: module 'unicodedata' has no attribute 'ucnhash_CAPI'

Please revert the removal and deprecate the attribute for 2 Python releases if 
you want to remove it.

Thanks

--
components: Library (Lib)
messages: 395792
nosy: hroncok, vstinner
priority: normal
severity: normal
status: open
title: unicodedata.ucnhash_CAPI removed from Python 3.10 without deprecation
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue38460] 3.8 Release Notes: document asyncio exception changes

2021-06-14 Thread Sebastian Rittau


Sebastian Rittau  added the comment:

Closing per the comments by Andrew and Raymond and the fact that 3.8 has been 
released for quite some while now.

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



[issue38460] 3.8 Release Notes: document asyncio exception changes

2021-06-14 Thread Sebastian Rittau


Change by Sebastian Rittau :


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



[issue44337] Port LOAD_ATTR to adaptive interpreter

2021-06-14 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +25306
pull_request: https://github.com/python/cpython/pull/26718

___
Python tracker 

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



[issue44417] bytecode<>line number mapping seems wrong in 3.10.0b2

2021-06-14 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue44392] Py_GenericAlias is not documented

2021-06-14 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I'm not working on this. Feel free to work on a PR.

--

___
Python tracker 

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-14 Thread STINNER Victor


STINNER Victor  added the comment:

> I mention the QueryPerformanceFrequency error case here (stack misalignment): 
> https://bugs.python.org/issue41299#msg395237

Do you think that pytime.c has the bug? I don't think so.

> There are three places win_perf_counter_frequency() can fail: 
> https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Python/pytime.c#L974

In theory yes, in practice we got zero error reports. So it sounds like it 
cannot happen.

I don't think that it's a good pratice to start to add checks in all functions 
using a clock "just in case" the clock might fail.

--

___
Python tracker 

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



  1   2   >