[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher


New submission from Brandt Bucher :

Currently, it isn't legal to perform <, >, <=, or >= rich comparisons on any 
complex objects, even though these operations are mathematically well-defined 
for real numbers.

The attached PR addresses this by defining rich comparisons for real-valued 
complex objects against subclasses of int and float, as well as for 
decimal.Decimal and fractions.Fraction types. They still raise TypeErrors when 
either of the operands has a nonzero imaginary part.

--
components: Interpreter Core
messages: 336628
nosy: brandtbucher
priority: normal
severity: normal
status: open
title: Allow rich comparisons for real-valued complex objects.
type: enhancement
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



[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher


Change by Brandt Bucher :


--
keywords: +patch
pull_requests: +12073
stage:  -> patch review

___
Python tracker 

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



[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I don't think we should do this. In numerical computation we should not depend 
on exact floating point values, because is affected by computation errors. It 
would be hard to debug the program when some complex numbers are orderable, but 
other are not, and the difference between formers and latters is insignificant.

--
nosy: +mark.dickinson, serhiy.storchaka

___
Python tracker 

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



[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If you need to order real-valued complex object, convert them to float objects 
first.

--

___
Python tracker 

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



[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher


Brandt Bucher  added the comment:

I don't really see, though, how comparing complex(42) == float(42) is any less 
dangerous than complex(42) <= float(42). It seems odd to me, personally, that 
real-valued complex objects are valid for *some* rich comparisons (but not 
others) when the math is unambiguous.

--

___
Python tracker 

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



[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Mark Dickinson


Mark Dickinson  added the comment:

-1 from me. The rules for when things are comparable or not should be kept 
simple.

--

___
Python tracker 

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



[issue36106] resolve sinpi() name clash with libm

2019-02-26 Thread Kubilay Kocak


Kubilay Kocak  added the comment:

Downstream issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232792

--
nosy: +koobs
versions: +Python 2.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



[issue36118] Cannot correctly concatenate nested list that contains more than ~45 entries with other nested lists.

2019-02-26 Thread Domenico Barbieri


New submission from Domenico Barbieri :

Here is an example of what happens:

>>> x = [["a", "b", ... , "BZ"]]
>>> y = [[], [1,2,3,4,5, ... , 99]]
>>> y[0] = x[0]
>>> print(y[0])
>>> ["a", "b", "c", ... , "BZ", [1,2,3,4,5, ... , 99]]

--
messages: 336634
nosy: Domenico Barbieri
priority: normal
severity: normal
status: open
title: Cannot correctly concatenate nested list that contains more than ~45 
entries with other nested lists.
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue36118] Cannot correctly concatenate nested list that contains more than ~45 entries with other nested lists.

2019-02-26 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I cannot reproduce the behaviour you show.

First problem: ``...`` is a legal Python object, Ellipsis, so your example code 
literally means:

# x = [["a", "b", ... , "BZ"]]

x is a list containing one sublist, which contains exactly four objects.

So when I run your code as you write it, I get:

py> x = [["a", "b", ... , "BZ"]]
py> y = [[], [1,2,3,4,5, ... , 99]]
py> y[0] = x[0]
py> print(y[0])
['a', 'b', Ellipsis, 'BZ']


which is exactly what I expect.

If we use more than 45 entries, as you suggest, I still cannot reproduce your 
bug report:


py> x = [ list(range(0, 100)) ]
py> y = [ [], list(range(1000, 1200)) ]
py> assert len(x[0]) > 45
py> assert len(y[1]) > 45
py> y[0] = x[0]
py> print(y[0])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 
62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 
82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

which is exactly the behaviour I expect.


The above is using Python 3.5.


I suggest you start from a fresh interpreter session and show precisely what 
steps needed to reproduce the behaviour you are seeing, and show the behaviour 
you expect. It might help to read this:

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



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x

2019-02-26 Thread Geoff Shannon


Change by Geoff Shannon :


--
pull_requests: +12074

___
Python tracker 

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



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x

2019-02-26 Thread Geoff Shannon


Geoff Shannon  added the comment:

I took a shot at fixing this in a smaller more targeted patch.  I think this 
should still solve the major issue of pty.spawn hanging on platforms that don't 
raise an error.  In addition, pty.spawn should now _ALWAYS_ return the terminal 
to the previous settings.

--
nosy: +RadicalZephyr

___
Python tracker 

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



[issue36106] resolve sinpi() name clash with libm

2019-02-26 Thread Dmitrii Pasechnik


Change by Dmitrii Pasechnik :


--
pull_requests: +12076

___
Python tracker 

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



[issue31904] Python should support VxWorks RTOS

2019-02-26 Thread Peixing Xin


Change by Peixing Xin :


--
pull_requests: +12077

___
Python tracker 

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



[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


--
pull_requests: +12078

___
Python tracker 

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



[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread Sergey Fedoseev


Sergey Fedoseev  added the comment:

I added WIP PR with discussed micro-optimization, here are benchmark results:

$ python -m perf compare_to --min-speed 1 -G master.json tuple-untracked.json
Slower (1):
- sqlite_synth: 5.16 us +- 0.10 us -> 5.22 us +- 0.08 us: 1.01x slower (+1%)

Faster (19):
- python_startup: 12.9 ms +- 0.7 ms -> 12.2 ms +- 0.0 ms: 1.06x faster (-5%)
- python_startup_no_site: 8.96 ms +- 0.29 ms -> 8.56 ms +- 0.03 ms: 1.05x 
faster (-4%)
- raytrace: 882 ms +- 11 ms -> 854 ms +- 12 ms: 1.03x faster (-3%)
- mako: 27.9 ms +- 0.8 ms -> 27.1 ms +- 0.3 ms: 1.03x faster (-3%)
- scimark_monte_carlo: 176 ms +- 4 ms -> 171 ms +- 5 ms: 1.03x faster (-3%)
- logging_format: 17.7 us +- 0.4 us -> 17.2 us +- 0.3 us: 1.03x faster (-3%)
- telco: 11.0 ms +- 0.2 ms -> 10.8 ms +- 0.4 ms: 1.02x faster (-2%)
- richards: 123 ms +- 2 ms -> 120 ms +- 2 ms: 1.02x faster (-2%)
- pathlib: 35.1 ms +- 0.7 ms -> 34.6 ms +- 0.5 ms: 1.01x faster (-1%)
- scimark_sparse_mat_mult: 6.97 ms +- 0.20 ms -> 6.88 ms +- 0.29 ms: 1.01x 
faster (-1%)
- scimark_sor: 327 ms +- 6 ms -> 323 ms +- 3 ms: 1.01x faster (-1%)
- scimark_fft: 570 ms +- 5 ms -> 562 ms +- 4 ms: 1.01x faster (-1%)
- float: 184 ms +- 2 ms -> 182 ms +- 2 ms: 1.01x faster (-1%)
- logging_simple: 15.8 us +- 0.4 us -> 15.6 us +- 0.3 us: 1.01x faster (-1%)
- deltablue: 12.6 ms +- 0.2 ms -> 12.5 ms +- 0.3 ms: 1.01x faster (-1%)
- crypto_pyaes: 186 ms +- 2 ms -> 184 ms +- 2 ms: 1.01x faster (-1%)
- hexiom: 17.3 ms +- 0.1 ms -> 17.2 ms +- 0.1 ms: 1.01x faster (-1%)
- sqlalchemy_declarative: 253 ms +- 4 ms -> 251 ms +- 3 ms: 1.01x faster (-1%)
- spectral_norm: 225 ms +- 2 ms -> 223 ms +- 3 ms: 1.01x faster (-1%)

--

___
Python tracker 

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



[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Eric V. Smith


Eric V. Smith  added the comment:

-1. We don't want to have objects that are orderable depending on their values. 
I can't think of anywhere else we do this.

It would be very easy to have a complex == 42+0.001j, after some 
calculation. This near-zero imaginary part would prevent it from being 
orderable, while if a similar calculation produced exactly 42+0j, then that 
instance would be orderable. An application relying on this would be a 
nightmare to write comprehensive tests for.

Whether something is orderable or not should depend solely on its type, not its 
value.

--
nosy: +eric.smith

___
Python tracker 

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



[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread Sergey Fedoseev


Sergey Fedoseev  added the comment:

This optimization also can be used for BUILD_TUPLE opcode and in pickle module, 
if it's OK to add _PyTuple_StealFromArray() function :-)

--

___
Python tracker 

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



[issue36106] resolve sinpi() name clash with libm

2019-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b545ba0a508a5980ab147ed2641a42be3b31a2db by Serhiy Storchaka 
(Dima Pasechnik) in branch '2.7':
[2.7] bpo-36106: resolve sinpi name clash with libm (IEEE-754 violation). 
(GH-12027) (GH-12050)
https://github.com/python/cpython/commit/b545ba0a508a5980ab147ed2641a42be3b31a2db


--

___
Python tracker 

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



[issue36106] resolve sinpi() name clash with libm

2019-02-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue36119] Can't add/append in set/list inside shared dict

2019-02-26 Thread Andrei Stefan


New submission from Andrei Stefan :

I'm creating a shared dict for multiprocessing purposes:

from multiprocessing import Manager

manager = Manager()
shared_dict = manager.dict()

If I add a set or a list as a value in the dict:
shared_dict['test'] = set() or shared_dict['test'] = list()

I can't add/append in that set/list inside the shared dictionary:
shared_dict['test'].add(1234) or shared_dict['test'].append(1234)

The following expression:
print(dict(shared_dict))

Will return:
{'test': set()} or {'test': []}.

But if I add in the set/list using operators:
shared_dict['test'] |= {1234} or shared_dict['test'] += [1234]

It will work:
{'test': {1234}} or {'test': [1234]}.

--
components: Build
files: image (2).png
messages: 336642
nosy: andrei2peu
priority: normal
severity: normal
status: open
title: Can't add/append in set/list inside shared dict
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48171/image (2).png

___
Python tracker 

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



[issue36109] test_descr: test_vicious_descriptor_nonsense() fails randomly

2019-02-26 Thread STINNER Victor


Change by STINNER Victor :


--
title: test_descr fails on AMD64 Windows8 3.x buildbots -> test_descr: 
test_vicious_descriptor_nonsense() fails randomly

___
Python tracker 

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



[issue36103] Increase shutil.COPY_BUFSIZE

2019-02-26 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

@Inada: having played with this in the past I seem to remember that on Linux 
the bigger bufsize doesn't make a reasonable difference (but I may be wrong), 
that's why I suggest to try some benchmarks. In issue33671 I pasted some 
one-liners you can use (and you should target copyfileobj() instead of 
copyfile() in order to skip the os.sendfile() path). Also on Linux "echo 3 | 
sudo tee /proc/sys/vm/drop_caches" is supposed to  disable the cache.

--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue36119] Can't add/append in set/list inside shared dict

2019-02-26 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

https://docs.python.org/3/library/multiprocessing.html#proxy-objects

> If standard (non-proxy) list or dict objects are contained in a referent, 
> modifications to those mutable values will not be propagated through the 
> manager because the proxy has no way of knowing when the values contained 
> within are modified. However, storing a value in a container proxy (which 
> triggers a __setitem__ on the proxy object) does propagate through the 
> manager and so to effectively modify such an item, one could re-assign the 
> modified value to the container proxy

$ ./python.exe
Python 3.8.0a2+ (heads/master:d5a551c269, Feb 26 2019, 15:49:14)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing import Manager
>>> man = Manager()
>>> shared_list = man.dict()
>>> shared_list['a'] = list()
>>> shared_list['a'].append(100)
>>> shared_list

>>> dict(shared_list)
{'a': []}
>>> shared_list['a'] += [1000] # Update and assign
>>> dict(shared_list)
{'a': [1000]}
>>> shared_list['a'] += [1000] # Update and assign
>>> dict(shared_list)
{'a': [1000, 1000]}

--
nosy: +pitrou, xtreak

___
Python tracker 

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



[issue35652] Add use_srcentry parameter to shutil.copytree() II

2019-02-26 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:


New changeset c606a9cbd48f69d3f4a09204c781dda9864218b7 by Giampaolo Rodola in 
branch 'master':
bpo-35652: shutil.copytree(copy_function=...) erroneously pass DirEntry instead 
of path str (GH-11997)
https://github.com/python/cpython/commit/c606a9cbd48f69d3f4a09204c781dda9864218b7


--

___
Python tracker 

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



[issue34624] -W option and PYTHONWARNINGS env variable does not accept module regexes

2019-02-26 Thread Nick Coghlan


Nick Coghlan  added the comment:

I think the only reason I didn't mention this discrepancy in my doc updates is 
because I wasn't aware there *was* a discrepancy.

The weird syntax was then just an incorrect amalgamation of "optional argument" 
notation with an improperly escaped regex suffix.

--

___
Python tracker 

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



[issue35459] Use PyDict_GetItemWithError() instead of PyDict_GetItem()

2019-02-26 Thread STINNER Victor


STINNER Victor  added the comment:

> It seems like the change introduced a regression: bpo-36110.

While the test has been fixed, IMHO we need to better document this subtle 
behavior change since it can be surprising.

The test failed because PyObject_GetAttr() no longer ignores exceptions when 
getting the attribute from the type dictionary. It's a significant change 
compared to Python 3.7.

Right now, the change has not even a NEWS entry, whereas it's a backward 
incompatible change!

Don't get my wrong: the change is correct, we don't want to ignore arbitrary 
exceptions, it's just a matter of documentation.

--
nosy: +pablogsal
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue36103] Increase shutil.COPY_BUFSIZE

2019-02-26 Thread Inada Naoki


Inada Naoki  added the comment:

> Also on Linux "echo 3 | sudo tee /proc/sys/vm/drop_caches" is supposed to  
> disable the cache.

As I said already, shutil is not used only with cold cache.

If cache is cold, disk speed will be upper bound in most cases.
But when cache is hot, or using very fast NVMe disk, syscall overhead
can be non-negligible.

--

___
Python tracker 

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



[issue36120] Regression - Concurrent Futures

2019-02-26 Thread Jonathan


New submission from Jonathan :

I'm using Concurrent Futures to run some work in parallel 
(futures.ProcessPoolExecutor) on windows 7 x64. The code works fine in 3.6.3, 
and 3.5.x before that.
I've just upgraded to 3.7.2 and it's giving me these errors:

Process SpawnProcess-6:
Traceback (most recent call last):
  File "c:\_libs\Python37\lib\multiprocessing\process.py", line 297, in 
_bootstrap
self.run()
  File "c:\_libs\Python37\lib\multiprocessing\process.py", line 99, in run
self._target(*self._args, **self._kwargs)
  File "c:\_libs\Python37\lib\concurrent\futures\process.py", line 226, in 
_process_worker
call_item = call_queue.get(block=True)
  File "c:\_libs\Python37\lib\multiprocessing\queues.py", line 93, in get
with self._rlock:
  File "c:\_libs\Python37\lib\multiprocessing\synchronize.py", line 95, in 
__enter__
return self._semlock.__enter__()
PermissionError: [WinError 5] Access is denied

If I switch back to the 3.6.3 venv it works fine again.

--
messages: 336649
nosy: jonathan-lp
priority: normal
severity: normal
status: open
title: Regression - Concurrent Futures
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



[issue36120] Regression - Concurrent Futures

2019-02-26 Thread Jonathan


Jonathan  added the comment:

There's also this error too:

Traceback (most recent call last):
  File "c:\_libs\Python37\lib\multiprocessing\process.py", line 297, in 
_bootstrap
self.run()
  File "c:\_libs\Python37\lib\multiprocessing\process.py", line 99, in run
self._target(*self._args, **self._kwargs)
  File "c:\_libs\Python37\lib\concurrent\futures\process.py", line 226, in 
_process_worker
call_item = call_queue.get(block=True)
  File "c:\_libs\Python37\lib\multiprocessing\queues.py", line 94, in get
res = self._recv_bytes()
  File "c:\_libs\Python37\lib\multiprocessing\synchronize.py", line 98, in 
__exit__
return self._semlock.__exit__(*args)
OSError: [WinError 6] The handle is invalid

--

___
Python tracker 

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



[issue36121] csv: Non global alternative to csv.field_size_limit

2019-02-26 Thread Carlos Ramos


New submission from Carlos Ramos :

The function csv.field_size_limit gets and sets a global variable. It would be 
useful to change this limit in a per-reader or per-thread basis, so that a 
library can change it without affecting global state.

--
components: Extension Modules
messages: 336651
nosy: Carlos Ramos
priority: normal
severity: normal
status: open
title: csv: Non global alternative to csv.field_size_limit
type: enhancement
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



[issue36120] Regression - Concurrent Futures

2019-02-26 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Thank you for the report.  Please add a script that contains the least amount 
of code that would replicate the error.  Thanks!

>From the devguide:
> last but not least, you have to describe the problem in detail, including 
> what you expected to happen, what did happen, and how to replicate the 
> problem in the Comment field. Be sure to include whether any extension 
> modules were involved, and what hardware and software platform you were using 
> (including version information as appropriate).

--
nosy: +cheryl.sabella
stage:  -> test needed
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



[issue36122] Second run of 2to3 continues to modify output

2019-02-26 Thread bers


New submission from bers :

I did this on Windows 10:

P:\>python --version
Python 3.7.2

P:\>echo print 1, 2 > Test.py

P:\>python Test.py
  File "Test.py", line 1
print 1, 2
  ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(1, 2)?

P:\>2to3 -w Test.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored Test.py
--- Test.py (original)
+++ Test.py (refactored)
@@ -1 +1 @@
-print 1, 2
+print(1, 2)
RefactoringTool: Files that were modified:
RefactoringTool: Test.py

P:\>python Test.py
1 2

P:\>2to3 -w Test.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored Test.py
--- Test.py (original)
+++ Test.py (refactored)
@@ -1 +1 @@
-print(1, 2)
+print((1, 2))
RefactoringTool: Files that were modified:
RefactoringTool: Test.py

P:\>python Test.py
(1, 2)

Note how "print 1, 2" first becomes "print(1, 2)" (expected), then becomes 
"print((1, 2))" in the following run. This changes the output of Test.py

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 336653
nosy: bers
priority: normal
severity: normal
status: open
title: Second run of 2to3 continues to modify output
type: enhancement
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



[issue36120] Regression - Concurrent Futures

2019-02-26 Thread Jonathan


Jonathan  added the comment:

The "ProcessPoolExecutor Example" on this page breaks for me:

https://docs.python.org/3/library/concurrent.futures.html

--

___
Python tracker 

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



[issue36122] Second run of 2to3 continues to modify output

2019-02-26 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This seems to be same as issue35417 and some resolution on detecting these type 
of cases at issue10375.

--
nosy: +benjamin.peterson, xtreak

___
Python tracker 

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



[issue36098] asyncio: ssl client-server with "slow" read

2019-02-26 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Thanks for the report.

We definitely have to fix `AttributeError`.
Unfortunately, SSL implementation in asyncio is very tricky.

Yuri has an experimental asyncio ssl replacement in his uvloop project 
rewritten from scratch.
There is a plan to port it into asyncio itself.

P.S.
`await writer.drain()` doesn't send all data to buffer but ensures that the 
write buffer size is below high watermark limit 
(https://docs.python.org/3/library/asyncio-protocol.html#asyncio.WriteTransport.set_write_buffer_limits)

Actually, it is good. Even after pushing a data into socket buffer you have no 
knowledge when the data is delivered to peer (or maybe not delivered at all at 
the moment of socket closing).
Moreover, when I experimented with write buffer disabling 
(transport.set_write_buffer_limits(1)) in aiohttp server benchmarks was 
executed about 50% slower for simple 'ping' request.

--

___
Python tracker 

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



[issue36116] test_multiprocessing_spawn fails on AMD64 Windows8 3.x

2019-02-26 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



[issue36121] csv: Non global alternative to csv.field_size_limit

2019-02-26 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Carlos, I think this can be added as a new `field_size_limit` keyword 
argument to csv.reader().

I will work on it.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue36123] Race condition in test_socket

2019-02-26 Thread Joannah Nanjekye


New submission from Joannah Nanjekye :

Looking at the buildbot failures, there is a race condition in a test_socket 
test:

def _testWithTimeoutTriggeredSend(self):
address = self.serv.getsockname()
with open(support.TESTFN, 'rb') as file:
with socket.create_connection(address, timeout=0.01) as sock:
meth = self.meth_from_sock(sock)
self.assertRaises(socket.timeout, meth, file)

def testWithTimeoutTriggeredSend(self):
conn = self.accept_conn()
conn.recv(88192)

on slow buildbot, create_connection() fails with a timeout exception sometimes 
because the server fails to start listing in less than 10 ms. 

https://buildbot.python.org/all/#/builders/167/builds/597

==
ERROR: testWithTimeoutTriggeredSend (test.test_socket.SendfileUsingSendTest)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/test_socket.py",
line 5796, in testWithTimeoutTriggeredSend
conn = self.accept_conn()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/test_socket.py",
line 5607, in accept_conn
conn, addr = self.serv.accept()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/socket.py",
line 212, in accept
fd, addr = self._accept()
socket.timeout: timed out

==
ERROR: testWithTimeoutTriggeredSend (test.test_socket.SendfileUsingSendTest)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/test_socket.py",
line 335, in _tearDown
raise exc
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/test_socket.py",
line 353, in clientRun
test_func()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/test_socket.py",
line 5791, in _testWithTimeoutTriggeredSend
with socket.create_connection(address, timeout=0.01) as sock:
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/socket.py",
line 727, in create_connection
raise err
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/socket.py",
line 716, in create_connection
sock.connect(sa)
socket.timeout: timed out

Note: Reported my Victor. I created the bug to track.

--
components: Tests
messages: 336658
nosy: nanjekyejoannah
priority: normal
severity: normal
status: open
title: Race condition in test_socket
type: behavior
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



[issue36123] Race condition in test_socket

2019-02-26 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
keywords: +patch
pull_requests: +12079
stage:  -> patch review

___
Python tracker 

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Nick Coghlan


Nick Coghlan  added the comment:

Next incompatibility: https://github.com/python-hyper/brotlipy/issues/147 
(which indirectly broke httpbin)

--

___
Python tracker 

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Nick Coghlan


Nick Coghlan  added the comment:

(On closer inspection, that's actually be the same breakage as already 
mentioned above)

However, what I'm not clear on is how this would affect projects that had 
*already* generated their cffi code, and include that in their sdist. Are all 
those sdists going to fail to build on Python 3.8 now?

It's OK to require that extension modules be rebuilt for a new release, but 
breaking compatibility with a *code generator* that means a broad selection of 
projects are all going to fail to build is a much bigger problem.

--

___
Python tracker 

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

@nick which indirectly broke httpbin and this one is used by python-requests 
and we can't execute the tests of requests.

--
nosy: +matrixise

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2019-02-26 Thread Nick Coghlan


Nick Coghlan  added the comment:

Yep, I completely understand (and agree with) the desire to eliminate the code 
injection exploit that was introduced decades ago by using exec() to run lines 
starting with "import " (i.e. "import sys; ").

I just don't want to lose the "add this location to sys.path" behaviour that 
exists for lines in pth files that *don't* start with "import ", since that has 
plenty of legitimate use cases, and the only downside of overusing it is an 
excessively long default sys.path (which has far more consistent and obvious 
symptoms than the arbitrary code execution case can lead to).

--

___
Python tracker 

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



[issue31916] ensurepip not honoring value of $(DESTDIR) - pip not installed

2019-02-26 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Closing as third-party as @yan12125's report pinpoints the cause of the issue 
as part of pip.

--
nosy: +cheryl.sabella
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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Armin Rigo


Armin Rigo  added the comment:

@nick the C sources produced by cffi don't change.  When they are compiled, 
they use Py_LIMITED_API so you can continue using a single compiled module 
version for any recent-enough Python 3.x.  The required fix is only inside the 
cffi module itself.

--

___
Python tracker 

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



[issue36041] email: folding of quoted string in display_name violates RFC

2019-02-26 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +12080
stage:  -> patch review

___
Python tracker 

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



[issue36120] Regression - Concurrent Futures

2019-02-26 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Thank you.  I just tried running the example and it worked OK for me in the 3.8 
master build.  I believe your report is a duplicate of issue 35797.

--
resolution:  -> duplicate
stage: test needed -> resolved
status: open -> closed
superseder:  -> concurrent.futures.ProcessPoolExecutor does not work in venv on 
Windows

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-02-26 Thread Nick Coghlan


Nick Coghlan  added the comment:

As a note in favour of the "Allow package nesting to be encoded in names, not 
just directories" approach, we actually have a similar problem affecting 
builtin modules: they're currently limited to top-level modules, with no way 
for the module to indicate that it's actually part of the parent package. 
Details at https://bugs.python.org/issue1644818 (yes, that's a SourceForge era 
issue number).

The solutions may not overlap in practice, but they're conceptually related 
(i.e. outside frozen modules, the package topology is pretty tightly coupled to 
the underlying filesystem layout)

--

___
Python tracker 

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



[issue36041] email: folding of quoted string in display_name violates RFC

2019-02-26 Thread Aaryn Tonita


Aaryn Tonita  added the comment:

Sorry about the delay. I opened pull request 
https://github.com/python/cpython/pull/12054 for this. Let me know if you need 
anything else.

--

___
Python tracker 

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



[issue36041] email: folding of quoted string in display_name violates RFC

2019-02-26 Thread Aaryn Tonita


Aaryn Tonita  added the comment:

Although I am not personally interested in backporting a fix for this issue, 
anyone that experiences this issue in python 3.5 can execute the following 
monkey patch to solve the issue:

def _fix_issue_36041_3_5():
from email._header_value_parser import QuotedString, ValueTerminal, 
quote_string
import email._header_value_parser

class BareQuotedString(QuotedString):

token_type = 'bare-quoted-string'

def __str__(self):
return quote_string(''.join(str(x) for x in self))

@property
def value(self):
return ''.join(str(x) for x in self)

@property
def parts(self):
parts = list(self)
escaped_parts = []
for part in parts:
if isinstance(part, ValueTerminal):
escaped = quote_string(str(part))[1:-1]
escaped_parts.append(ValueTerminal(escaped, 'ptext'))
else:
escaped_parts.append(part)
# Add quotes to the first and last parts.
escaped_parts[0] = ValueTerminal('"' + str(escaped_parts[0]), 
'ptext')
escaped_parts[-1] = ValueTerminal(str(escaped_parts[-1] + '"'), 
'ptext')
return escaped_parts

email._header_value_parser.BareQuotedString = BareQuotedString

--

___
Python tracker 

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



[issue21879] str.format() gives poor diagnostic on placeholder mismatch

2019-02-26 Thread Carlos Damázio

Carlos Damázio  added the comment:

I've noticed this issue is quite not active, but I'm up on participating in it 
if anyone is doing it already. Since then, this issue still persists:

>>> '{1}'.format()
Traceback (most recent call last):
  File "", line 1, in 
IndexError: tuple index out of range

Reading further, I agree that improving the message is suitable. We should 
leave the Index Exception while changing the text to "Replacement index %d out 
of range for positional args tuple". Even though I find it quite extent for an 
exception message, I guess it couldn't be any other way, unless someone gives a 
better suggestion.

--
nosy: +dmzz

___
Python tracker 

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



[issue36124] Provide convenient C API for storing per-interpreter state

2019-02-26 Thread Nick Coghlan


New submission from Nick Coghlan :

(New issue derived from https://bugs.python.org/issue35886#msg336501 )

cffi needs a generally available way to get access to a caching dict for the 
currently active subinterpreter. Currently, they do that by storing it as an 
attribute in the builtins namespace: 
https://bitbucket.org/cffi/cffi/src/07d1803cb17b230571e3155e52082a356b31d44c/c/call_python.c?fileviewer=file-view-default

As a result, they had to amend their code to include the CPython internal 
headers in 3.8.x, in order to regain access to the "builtins" reference.

Armin suggested that a nicer way for them to achieve the same end result is if 
there was a PyInterpreter_GetDict() API, akin to 
https://docs.python.org/3/c-api/init.html#c.PyThreadState_GetDict

That way they could store their cache dict in there in 3.8+, and only use the 
builtin dict on older Python versions.

--
messages: 336670
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Provide convenient C API for storing per-interpreter state

___
Python tracker 

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



[issue36124] Provide convenient C API for storing per-interpreter state

2019-02-26 Thread Nick Coghlan


Change by Nick Coghlan :


--
stage:  -> needs patch
type:  -> enhancement
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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Nick Coghlan


Nick Coghlan  added the comment:

Oh, cool (both the fact the issue here is only with building cffi itself, and 
that cffi creates extension modules that build with PY_LIMITED_API).

I've filed https://bugs.python.org/issue36124 to follow up on the 
PyInterpreter_GetDict API idea.

--

___
Python tracker 

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



[issue21879] str.format() gives poor diagnostic on placeholder mismatch

2019-02-26 Thread Carlos Damázio

Carlos Damázio  added the comment:

Ops, someone already patched it! Sorry guys.

--

___
Python tracker 

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



[issue36122] Second run of 2to3 continues to modify output

2019-02-26 Thread Paul Ganssle


Paul Ganssle  added the comment:

Because what's being printed is a tuple, I think it's not exactly the same as 
issue35417, because in fact this is the correct behavior for 2to3, note that in 
Python 2:

Python 2.7.15 (default, Jul 21 2018, 11:13:03) 
>>> print 1, 2 
1 2
>>> print(1, 2)
(1, 2)

And in Python 3:

Python 3.7.2 (default, Feb  9 2019, 13:18:43) 
>>> print(1, 2)
1 2
>>> print((1, 2))
(1, 2)

I think this bug report is based on an understandable misunderstanding of what 
2to3 does - 2to3 is not intended to be idempotent or to generate code the works 
for both Python 2 and Python 3, it's intended to translate Python 2 code into 
Python 3, so passing it something that is *already Python 3 code* you are not 
guaranteed to get a meaningful output from it.

In this case, it first translates `print 1, 2` (Python 2) into `print(1, 2)` 
(Python 3), then when you run it a second time, it translates `print(1, 2)` 
(Python 2) into `print((1, 2))` (Python 3) - in both cases it's doing the right 
thing.

@bers I hope that this has helped to clarify the situation. Thank you for 
taking the time to report this.

--
nosy: +p-ganssle

___
Python tracker 

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



[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-26 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> Proposed spec:
> '''
> Modify the API statistics.mode to handle multimodal cases so that the 
> first mode encountered is the one returned.  If the input is empty, 
> raise a StatisticsError.

Are you happy guaranteeing that it will always be the first mode 
encountered? I'm not happy about it, but I'll follow you lead on this 
one.

> TestCases:
> mode([])   --> StatisticsError
> mode('aabbbcc') --> 'c'

That should be 'b'.

> mode(iter('aabbbcc')) --> 'c'

And again 'b'.

> mode('eeffgg') --> 'a'

If it is first encountered, that should be 'd'.

--

___
Python tracker 

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



[issue36122] Second run of 2to3 continues to modify output

2019-02-26 Thread bers


bers  added the comment:

Yes, understood! Thanks for the explanation.

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Armin Rigo


Armin Rigo  added the comment:

Cool.  Also, no bugfix release of cffi was planned, but I can make one if you 
think it might help for testing the current pre-release of CPython 3.8.

--

___
Python tracker 

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



[issue33608] [subinterpreters] Add a cross-interpreter-safe mechanism to indicate that an object may be destroyed.

2019-02-26 Thread STINNER Victor


STINNER Victor  added the comment:

> ...so it doesn't appear that my PR introduces a performance regression.

IMHO there is no performance regression at all. Just noice in the result which 
doesn't come with std dev.

--

___
Python tracker 

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



[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher


Brandt Bucher  added the comment:

> The rules for when things are comparable or not should be kept simple.

I think that the sort of user who uses complex numbers for their numerical 
calculations would still find this behavior "simple", but that may just be me.

> We don't want to have objects that are orderable depending on their values. I 
> can't think of anywhere else we do this.

Well... tuples and lists behave this way. ;)

> An application relying on this would be a nightmare to write comprehensive 
> tests for.

I'm not arguing that applications should rely on this behavior as core 
functionality, just that Python's more advanced math functionality deserves to 
be correct.

With that said, there are already so many weird limitations on complex numbers 
and floating-point values in general. I wouldn't expect users to treat 
comparing complex numbers any differently than they would treat comparing 
floats. Check check the .imag value in the former, check math.isnan in the 
latter.

--

___
Python tracker 

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

@arigo 

Yep, I am interested because I would like to execute the tests of the major 
projects/libraries (django, flasks, pandas, requests, ...) and create issues 
for the maintainer.

the sooner we get feedback, the sooner we can fix the bugs.

--

___
Python tracker 

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



[issue31904] Python should support VxWorks RTOS

2019-02-26 Thread STINNER Victor


STINNER Victor  added the comment:

Kuhl, Brian started a new discussion: [Python-Dev] VxWorks and cpython?
https://mail.python.org/pipermail/python-dev/2019-January/156024.html

PR 11968 and PR 12051 are small and reasonable.

IMHO we can take decisions on a case by case basic. But WindRiver plans to 
provide a buildbot and is already showing their will to propose PRs, so it 
seems like things are moving on.

--

___
Python tracker 

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



[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Brandt Bucher


Change by Brandt Bucher :


--
type: enhancement -> behavior

___
Python tracker 

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



[issue36117] Allow rich comparisons for real-valued complex objects.

2019-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

NaN and complex numbers are not orderable by definition. This is a feature, not 
a bug.

--
resolution:  -> not a bug
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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Armin Rigo


Armin Rigo  added the comment:

Done.

--

___
Python tracker 

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



[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread STINNER Victor


STINNER Victor  added the comment:

> This optimization also can be used for BUILD_TUPLE opcode and in pickle 
> module, if it's OK to add _PyTuple_StealFromArray() function :-)

I would like to see a micro-benchmark showing that it's faster.

--

___
Python tracker 

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



[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread STINNER Victor


STINNER Victor  added the comment:

Can you please convert msg336142 into a perf script? See the doc:
https://perf.readthedocs.io/en/latest/developer_guide.html

And then run again these benchmarks on PR 12052.

If you have a script, you can do:

./python-ref script.py -o ref.json
./python-untracked script.py -o untracked.json
./python-untracked -m perf compare_to ref.json untracked.json

https://perf.readthedocs.io/en/latest/cli.html#compare-to-cmd

--

___
Python tracker 

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



[issue36103] Increase shutil.COPY_BUFSIZE

2019-02-26 Thread Inada Naoki


Inada Naoki  added the comment:

Read this file too.
http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/ioblksize.h

coreutils choose 128KiB for *minimal* buffer size to reduce syscall overhead.
In case of shutil, we have Python interpreter overhead adding to syscall 
overhead.
Who has deeper insights than coreutils author?

I think 128KiB is the best, but I'm OK to 64KiB for conservative decision.

--

___
Python tracker 

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



[issue35459] Use PyDict_GetItemWithError() instead of PyDict_GetItem()

2019-02-26 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

#36110 was closed as a duplicate; the superseder is #36109 (which has been 
fixed). The change should still be documented, just in case anyone gets bitten 
by it.

--
nosy: +josh.r

___
Python tracker 

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



[issue33608] [subinterpreters] Add a cross-interpreter-safe mechanism to indicate that an object may be destroyed.

2019-02-26 Thread Eric Snow


Eric Snow  added the comment:

FYI, I have a couple of small follow-up changes to land before I close this 
issue.

--

___
Python tracker 

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



[issue36125] Cannot cross-compile to more featureful but same tune

2019-02-26 Thread Ross Burton


New submission from Ross Burton :

My build machine is a Haswell Intel x86-64. I'm cross-compiling to x86-64, with 
-mtune=Skylake -avx2.  During make install PYTHON_FOR_BUILD loads modules from 
the *build* Lib/ which contain instructions my Haswell can't execute:

| 
_PYTHON_PROJECT_BASE=/data/poky-tmp/master/work/corei7-64-poky-linux/python3/3.7.2-r0/build
 _PYTHON_HOST_PLATFORM=linux-x86_64 PYTHONPATH=../Python-3.7.2/Lib 
_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_m_linux_x86_64-linux-gnu python3.7 -v 
-S -m sysconfig --generate-posix-vars ;\
Illegal instruction

--
components: Build
messages: 336688
nosy: rossburton
priority: normal
severity: normal
status: open
title: Cannot cross-compile to more featureful but same tune
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



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x

2019-02-26 Thread STINNER Victor


STINNER Victor  added the comment:

Please have a look at this pty.spawn() documentation change:
https://github.com/python/cpython/pull/11980

--

___
Python tracker 

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



[issue36123] Race condition in test_socket

2019-02-26 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 53b9e1a1c1d86187ad6fbee492b697ef8be74205 by Victor Stinner 
(Joannah Nanjekye) in branch 'master':
bpo-36123: Fix test_socket.testWithTimeoutTriggeredSend() race condition 
(GH-12053)
https://github.com/python/cpython/commit/53b9e1a1c1d86187ad6fbee492b697ef8be74205


--
nosy: +vstinner

___
Python tracker 

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



[issue36123] Race condition in test_socket

2019-02-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12081

___
Python tracker 

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



[issue35417] Double parenthesis in print function running 2to3 in already correct call

2019-02-26 Thread STINNER Victor


STINNER Victor  added the comment:

I suggest to close this issue as WONTFIX.

2to3 is designed as a tool to convert a Python 2 code base to Python 3 at once. 
I understand that once the code base is converted, you may want to revert some 
unwanted "useless" changes.

Python 2 and Python 3 languages have some intersections where it's hard to 
guess if the code is valid or not in Python 3. 2to3 uses heuristic which 
implements practical solutions. And you noticed, there are some corner cases 
where 2to3 generates useless changes.

IMHO 2to3 is fine. It may be nice to enhance it, but well, it's a trade-off, 
it's good as it is.

You may want to test other tools like modernize, 2to6, sixer, etc. which made 
different trade-offs.

Note: I'm the author of sixer and I'm not a big of 2to3 since it drops Python 2 
support and generate many changes which are not needed since Python 3.2.

--
nosy: +vstinner

___
Python tracker 

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



[issue36106] resolve sinpi() name clash with libm

2019-02-26 Thread Mark Dickinson


Mark Dickinson  added the comment:

This one was my fault. Thanks for the fix!

--

___
Python tracker 

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



[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Victor/vstinner: Isn't PR 12032 reintroducing the issue fixed in #29234? 
_PyStack_AsTuple was explicitly marked as _Py_NO_INLINE because inlining was 
creating excessive stack consumption in the callers (which were the bytecode 
interpreter loop), but the new _PyTuple_FromArray isn't marked as 
_Py_NO_INLINE, so the swap reintroduces the problem.

Seems like either:

1. _PyTuple_FromArray should also be marked _Py_NO_INLINE

or

2. _PyStack_AsTuple should continue to exist as the non-inlined version of 
_PyTuple_FromArray

It's possible this isn't as much of an issue because _PyTuple_FromArray is in 
tupleobject.c (where it's only called in one place), while _PyStack_AsTuple was 
in call.c and was called from within call.c in four places, but only if 
link-time optimization isn't involved (and in practice, most public 
distributions of CPython are built with link-time optimization now, correct?); 
if LTO is enabled, the same stack bloat issues are possible.

--
nosy: +josh.r

___
Python tracker 

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



[issue36123] Race condition in test_socket

2019-02-26 Thread miss-islington


miss-islington  added the comment:


New changeset 2632474957fa9c6311af21be6906d1234853f288 by Miss Islington (bot) 
in branch '3.7':
bpo-36123: Fix test_socket.testWithTimeoutTriggeredSend() race condition 
(GH-12053)
https://github.com/python/cpython/commit/2632474957fa9c6311af21be6906d1234853f288


--
nosy: +miss-islington

___
Python tracker 

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



[issue36124] Provide convenient C API for storing per-interpreter state

2019-02-26 Thread Eric Snow


Eric Snow  added the comment:

+1 from me

@Armin, thanks to Nick I understand your request better now.  I'll put up a PR 
by the end of the week if no one beats me to it.

--
nosy: +arigo, eric.snow

___
Python tracker 

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



[issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

2019-02-26 Thread Steve Dower


Steve Dower  added the comment:

Thanks, Zackery!

--
assignee:  -> steve.dower
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2019-02-26 Thread Enji Cooper


Change by Enji Cooper :


--
versions: +Python 2.7, Python 3.4, Python 3.5, 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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2019-02-26 Thread Enji Cooper


Enji Cooper  added the comment:

I'll try to rebase Martin's changes, as they don't apply to the master branch 
on GitHub today.

--

___
Python tracker 

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



[issue36125] Cannot cross-compile to more featureful but same tune

2019-02-26 Thread Ross Burton


Ross Burton  added the comment:

>From what I can tell:

configure.ac sets PYTHON_FOR_BUILD like this if cross-compiling:

PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) 
_PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f 
pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib 
_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) 
'$interp

Note how PYTHONPATH is set to the source and build paths for Lib/.

The intention appears to be that the sysconfig.py in the build is used.  In my 
case that directory is also full of shared libraries that Python happily loads, 
and then fails.

--

___
Python tracker 

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



[issue36126] Reference count leakage in structseq_repr

2019-02-26 Thread zasdfgbnm


New submission from zasdfgbnm :

In Python 2.7 structseq is not a tuple, and in `structseq_repr` a tuple is 
created to help extracting items. However when the check at 
https://github.com/python/cpython/blob/2.7/Objects/structseq.c#L268 fails, the 
reference count of this tuple is not decreased, causing memory leakage.

To reproduce, download the attached file, install and run the `quicktest.py` 
and watch the memory usage.

This bug only exists on python 2.7, because on python >3.2, no helper tuple is 
created.

--
components: Interpreter Core
files: structseq.tar.xz
messages: 336699
nosy: zasdfgbnm
priority: normal
pull_requests: 12082
severity: normal
status: open
title: Reference count leakage in structseq_repr
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file48172/structseq.tar.xz

___
Python tracker 

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



[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

2019-02-26 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

This is a follow up of issue23867 and issue35582. The proposed PR makes 
Argument Clinic inlining parsing code for functions with keyword parameters, 
i.e. functions that use _PyArg_ParseTupleAndKeywordsFast() and 
_PyArg_ParseStackAndKeywords() now. This saves time for parsing format strings 
and calling few levels of functions.

--
assignee: serhiy.storchaka
components: Argument Clinic
messages: 336700
nosy: larry, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Argument Clinic: inline parsing code for functions with keyword 
parameters
type: performance
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



[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

2019-02-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +12083
stage:  -> patch review

___
Python tracker 

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



[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

2019-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Some examples:

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000 -s "round_ = round" "round_(4.2)"
Mean +- std dev: [...] 110 ns +- 3 ns -> [...] 81.4 ns +- 2.2 ns: 1.35x faster 
(-26%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000 -s "sum_ = sum" "sum_(())"
Mean +- std dev: [...] 88.0 ns +- 6.5 ns -> [...] 57.6 ns +- 1.1 ns: 1.53x 
faster (-35%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000 -s "sum_ = sum; a = [1, 2]"  "sum_(a)"
Mean +- std dev: [...] 95.9 ns +- 2.1 ns -> [...] 70.6 ns +- 2.0 ns: 1.36x 
faster (-26%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000  "'abc'.split()"  
Mean +- std dev: [...] 102 ns +- 3 ns -> [...] 80.5 ns +- 2.1 ns: 1.26x faster 
(-21%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000  "b'abc'.split()"
Mean +- std dev: [...] 91.8 ns +- 2.3 ns -> [...] 75.1 ns +- 1.4 ns: 1.22x 
faster (-18%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000  "'abc'.split('-')"
Mean +- std dev: [...] 118 ns +- 2 ns -> [...] 89.2 ns +- 1.8 ns: 1.32x faster 
(-24%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000  "b'abc'.decode()"
Mean +- std dev: [...] 96.1 ns +- 3.6 ns -> [...] 78.9 ns +- 2.2 ns: 1.22x 
faster (-18%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000  "'abc'.encode()"
Mean +- std dev: [...] 72.4 ns +- 1.9 ns -> [...] 55.1 ns +- 1.8 ns: 1.31x 
faster (-24%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000 -s "int_= int"  "int(4.2)"
Mean +- std dev: [...] 105 ns +- 4 ns -> [...] 78.8 ns +- 1.9 ns: 1.33x faster 
(-25%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000 -s "int_= int"  "int('5')"
Mean +- std dev: [...] 154 ns +- 5 ns -> [...] 122 ns +- 4 ns: 1.26x faster 
(-21%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000  "42 .to_bytes(2, 'little')
Mean +- std dev: [...] 109 ns +- 3 ns -> [...] 72.4 ns +- 1.9 ns: 1.51x faster 
(-34%)

$ ./python -m perf timeit --compare-to=../cpython-release-baseline/python 
--duplicate=1000 "from_bytes = int.from_bytes" "from_bytes(b'ab', 'little')"
Mean +- std dev: [...] 138 ns +- 3 ns -> [...] 96.3 ns +- 3.0 ns: 1.43x faster 
(-30%)

--

___
Python tracker 

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



[issue36119] Can't add/append in set/list inside shared dict

2019-02-26 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

As Karthikeyan, this is an inevitable, and documented, consequence of the 
proxies not being aware of in-place modification of their contents.

As your own example demonstrates, any approach that provides that information 
to the shared dict proxy will work; |= and += are almost the same as .update 
and .extend, but implemented such that the left hand side is always reassigned, 
even when the result of __ior__/__iadd__ is the same object it was called on. 
Thus, |=/+= work, while add/append/update/extend do not.

Note that as of 3.6, there is another option: Nested shared objects:

> Changed in version 3.6: Shared objects are capable of being nested. For 
> example, a shared container object such as a shared list can contain other 
> shared objects which will all be managed and synchronized by the SyncManager.

So the alternative solution in your case (assuming you're on 3.6 or later, 
which your bug version tags say you are) is to make the sub-lists 
manager.lists, or replace use of a set with manager.dict (as dicts with all 
values set to True, are largely compatible with set anyway, especially with the 
advent of dict views):

manager = Manager()
shared_dict = manager.dict()

shared_dict['test'] = manager.dict() # or shared_dict['test'] = manager.list()

shared_dict['test'][1234] = True # or shared_dict['test'].append(1234)

Downside: The repr of shared dicts/lists doesn't display the contents, so your 
example code won't make it obvious that the problem is fixed, but it does in 
fact work. I wrote a terrible JSON one-liner to check the contents, and it 
demonstrates that the shared dict/list work just fine:

import json
from multiprocessing import Manager
from multiprocessing.managers import DictProxy, ListProxy

manager = Manager()
shared_dict = manager.dict()

shared_dict['testset'] = set()
shared_dict['testlist'] = []
shared_dict['testshareddict'] = manager.dict()
shared_dict['testsharedlist'] = manager.list()

shared_dict['testset'].add(1234)
shared_dict['testlist'].append(1234)
shared_dict['testshareddict'][1234] = True
shared_dict['testsharedlist'].append(1234)

print(json.dumps(shared_dict, default=lambda x: dict(x) if isinstance(x, 
DictProxy) else
list(x) if isinstance(x, 
ListProxy) else
dict.fromkeys(x, True) if 
isinstance(x, (set, frozenset)) else
x))

The dump shows that the changes to the shared inner dict and list are reflected 
in the result directly, even with no assignment back to the keys of the outer 
dict (while, as you note, the plain set and list show no changes).

Closing as not a bug, since this is fully documented, with multiple workarounds 
available.

--
nosy: +josh.r
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



[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

2019-02-26 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

That's a lot faster and will be great if they make it to next alpha :) Adding 
Ammar Askar since they did review for positional arguments.

--
nosy: +ammar2, xtreak

___
Python tracker 

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



[issue36123] Race condition in test_socket

2019-02-26 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

I am closing this as it has been fixed by this PR 


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



[issue33944] Deprecate and remove pth files

2019-02-26 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Feb 26, 2019, at 05:19, Nick Coghlan  wrote:
> 
> I just don't want to lose the "add this location to sys.path" behaviour that 
> exists for lines in pth files that *don't* start with "import ", since that 
> has plenty of legitimate use cases, and the only downside of overusing it is 
> an excessively long default sys.path (which has far more consistent and 
> obvious symptoms than the arbitrary code execution case can lead to).

It’s also very difficult to debug because pth loading usually happens before 
the user has a chance to intervene with a debugger.  This means mysterious 
things can happen, like different versions of a package getting imported than 
you expect.

Extending sys.path is a useful use case, but doing so in pth files is 
problematic.

--

___
Python tracker 

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



[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

2019-02-26 Thread Josh Rosenberg


Change by Josh Rosenberg :


--
nosy: +josh.r

___
Python tracker 

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



[issue36071] Add support for Windows ARM32 in ctypes/libffi

2019-02-26 Thread Paul Monson


Change by Paul Monson :


--
keywords: +patch
pull_requests: +12084
stage:  -> patch review

___
Python tracker 

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



[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

2019-02-26 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

How much bigger does the core interpreter + built-in extension modules get when 
you make this change? How much more memory is used by real world programs?

I'm a little concerned when I see individual functions growing by 140 lines in 
the first file of the diff. Clearly the increase in memory usage wasn't enough 
to slow down the microbenchmarks (which can probably fit the entire hot code 
path in CPU on die cache), but I'd be worried about the aggregate effect on 
real world programs if we go from a handful of argument parsing code paths 
reused by every function (and therefore kept constantly hot) to hundreds (or 
thousands?) of unique argument parsing code paths, each one unique to a single 
function. It could easily look great when a single function is being called 
repeatedly, while looking much less great (possibly worse) when the many varied 
function calls are interleaved.

It should be tested on a number of systems too; any losses to cache 
unfriendliness would be highly dependent on the size of the CPU cache.

I'll grant, it doesn't seem like inlining positional argument parsing has 
caused problems, and it looks like we're still using _PyArg_UnpackKeywords, so 
argument parsing isn't completely devolved to each functions, but I think we 
need something more than microbenchmarks before we jump on this.

If my worries end up being unfounded, I'll be happy. Looks very cool if we can 
really get that sort of speed up for all function calls, not just positional 
args only functions. :-)

--

___
Python tracker 

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



[issue36118] Cannot correctly concatenate nested list that contains more than ~45 entries with other nested lists.

2019-02-26 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Agreed, I cannot reproduce this (online link showing behavior): 
https://tio.run/##K6gsycjPM/7/v0LBViE6WilRSUdBKQlI6OnpKQCZTlFKsbFclWDJWB2FaEMdIx1jHRMdU5gKS0uQfLRBLFBJBZDiKijKzCvRAIlocv3/DwA

My guess is the code is subtly different, e.g. replacing:

>>> y[0] = x[0]
>>> print(y[0])

with:

>>> y[:1] = x[0]
>>> print(y)

would get roughly what the OP is seeing (and it would be the correct/expected 
result in that case). Either way, not a bug.

--
nosy: +josh.r
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



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x

2019-02-26 Thread Geoff Shannon


Geoff Shannon  added the comment:

I'm aware of it. I actually wrote that patch as well. :D

--

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2019-02-26 Thread Steve Dower


Steve Dower  added the comment:

> Extending sys.path is a useful use case, but doing so in pth files is 
> problematic.

There are 100 other ways to end up in this situation though. Why is *this* one 
so much worse?

Can you offer an issue you hit that was caused by a .pth file that *wasn't* 
debuggable by listing sys.path?

--

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2019-02-26 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Feb 26, 2019, at 12:32, Steve Dower  wrote:
> 
> There are 100 other ways to end up in this situation though. Why is *this* 
> one so much worse?

Because there’s no good place to stick a pdb/breakpoint to debug such issues 
other than site.py, and that usually requires sudo.

> Can you offer an issue you hit that was caused by a .pth file that *wasn't* 
> debuggable by listing sys.path?

I don’t remember the details, but yes I have been caught in this trap.  The 
thing is, by the time user code gets called, the damage is already done, so 
debugging is quite difficult.

This will be alleviated at least partially by deprecating the executing of 
random code.  Maybe just allowing sys.path hacking will be enough to make it 
not so terrible, especially if e.g. (and I haven’t check to see whether this is 
the case today), `python -v` shows you exactly which .pth file is extending 
sys.path.

The issue is discoverability.  Since pth files happen before you get an 
interpreter prompt, it’s too difficult to debug unexpected, wrong, or broken 
behavior.  My opposition would lessen if there were clear ways to debug, and 
preferably also prevent, pth interpretation.

--

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2019-02-26 Thread Ionel Cristian Mărieș

Ionel Cristian Mărieș  added the comment:

> Because there’s no good place to stick a pdb/breakpoint to debug such issues 
> other than site.py, and that usually requires sudo.

Something bad was installed with sudo but suddenly sudo is not acceptable for 
debugging? This seems crazy.

How exactly are pth files hard to debug? Are those files hard to edit? They 
sure are, but the problem ain't the point where they are run, it's the fact 
that a big lump of code is stuffed on a single line. Lets fix that instead!

I've written pth files with lots of stuff in them, and my experience is quite 
the opposite - they help with debugging. A lot. It's an incredibly useful 
python feature.

> I don’t remember the details, but yes I have been caught in this trap. 

Maybe if you remember the details we can discuss what are the debugging 
options, and what can be improved.

--

___
Python tracker 

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



  1   2   >