[issue20905] Adapt heapq push/pop/replace to allow passing a comparator.

2019-12-22 Thread Michael Rolle


Michael Rolle  added the comment:

I realize this request is closed, but I hope people will still be reading this 
comment, and can perhaps either reopen it or submit a new request.  I don't 
know how to submit a new request myself.
...

I'd like to see (key=) capability somehow, without degrading performance of 
time-critical applications.
I've got some ideas for your consideration, if you please.

1. Make the heapq into a heap class.  It would be more natural (for me, anyway) 
to push/pop using the heap's methods, rather than calling a function in the 
heap package and having to specify the heap list as well.

A heap class in C could outperform current heapq with lists by storing the 
member objects in an internal array.

This would also solve the issue of having the user switch comparison methods in 
the middle of things.  The comparison method would be specified when the heap 
is constructed.  It could be changed later, at the expense of resorting the 
heap.  I suggest the comparison method parameters be the same as for .sort () 
and sorted ().

By default, the heap class would directly compare elements using __lt__, and so 
the performance would be as good, or slightly better, than the current heapq 
package functions.

2. In my own use case, I have to define __lt__ for the objects in my heapq by 
comparing the _keys_ of the two items.  So push/pop wind up calling the key 
function many times anyway.  The heap push/pop themselves could do this same 
work probably a bit faster in C code than would calling my own __lt__ method.

3. Performance could be improved when there is a key function by having the 
heap store both the heap elements and their keys.  I believe a C implementation 
could benefit by storing key and value objects next to each other in the 
internal array.

4. I'd be happy to submit a reference implementation, only I don't have time to 
do that right now, sorry.  I'm sure someone else would be up to the challenge.

--
nosy: +mrolle

___
Python tracker 

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



[issue39121] gzip header write OS field

2019-12-22 Thread SilentGhost


Change by SilentGhost :


--
versions: +Python 3.9

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2019-12-22 Thread Bruce Merry


Bruce Merry  added the comment:

> It seems we can release GIL during iterating the buffer array.

That's what I had in mind. Naturally it would require a bit of benchmarking to 
pick a threshold such that the small case doesn't lose performance due to 
locking overheads. If no one else is working on it, I can give that a try early 
next year.

--

___
Python tracker 

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



[issue39121] gzip header write OS field

2019-12-22 Thread Rob Man


Change by Rob Man :


--
versions:  -Python 3.9

___
Python tracker 

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



[issue39117] Performance regression for making bound methods

2019-12-22 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

Probably #37340

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue39121] gzip header write OS field

2019-12-22 Thread Rob Man


Change by Rob Man :


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

___
Python tracker 

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



[issue39121] gzip header write OS field

2019-12-22 Thread Rob Man


New submission from Rob Man :

Files written with gzip module write a value of 255 (unknown) at the 10th 
position in the header which defined what OS was used when gzip file was 
written. 
Files written with gzip linux command correctly set that field to the value of 
3 (Unix).
This ehancement does that.

--
components: Library (Lib)
messages: 358801
nosy: wungad
priority: normal
severity: normal
status: open
title: gzip header write OS field
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2019-12-22 Thread Inada Naoki


Inada Naoki  added the comment:

https://github.com/python/cpython/blob/068768faf6b82478de239d7ab903dfb249ad96a4/Objects/stringlib/join.h#L105-L126

It seems we can release GIL during iterating the buffer array.
Even though there is no one big chunk, it would be beneficial if the output 
size is large enough (8MB+?).

--

___
Python tracker 

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



[issue39118] Variables changing values on their own

2019-12-22 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Leonardo, even if this were a bug, it would be a mistake to ascribe it to IDLE. 
 The IDLE Shell is an alternative display window. IDLE sends your code to 
Python and displays values computed by Python and output by print statements.  
I second Mark's suggestion to first ask questions on python-list or other 
forums (at least until one has substantial experience with Python).

--
assignee: terry.reedy -> 
components:  -IDLE

___
Python tracker 

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



[issue39120] pyodbc dll load failed

2019-12-22 Thread Eryk Sun


Eryk Sun  added the comment:

This may be due to changes regarding DLL dependency resolution in 3.8. If so, 
you can find the missing DLL using Process Monitor, configured to monitor file 
access in python.exe and pythonw.exe. Add the DLL's directory to the search 
path via os.add_dll_directory [1] before importing from pyodbc. 

The developers of pyodbc should be directed to the porting notes for the DLL 
search requirements in 3.8 [2]. The interpreter and ctypes no longer support 
the old DLL search path that includes the working directory and PATH [3].

[1] https://docs.python.org/3/library/os.html#os.add_dll_directory
[2] https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew
[3] 
https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order

--
nosy: +eryksun

___
Python tracker 

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



[issue39120] pyodbc dll load failed

2019-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This is a tracker for CPython issues. Please use the bug tracker for pyodbc or 
other forums like stack overflow for better solutions.

--
nosy: +xtreak
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



[issue39120] pyodbc dll load failed

2019-12-22 Thread Neil Faulkner


New submission from Neil Faulkner :

Please can someone advise as to the root cause of this error?

--
components: Library (Lib)
files: DLL.PNG
messages: 358796
nosy: nf00038
priority: normal
severity: normal
status: open
title: pyodbc dll load failed
type: compile error
versions: Python 3.8
Added file: https://bugs.python.org/file48800/DLL.PNG

___
Python tracker 

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



[issue39119] email/_header_value_parser.py:parse_message_id: UnblondLocalError

2019-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think this should be fixed with issue38698 in 3.8.1 . Can you please try the 
latest stable release.

--
nosy: +xtreak

___
Python tracker 

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



[issue39119] email/_header_value_parser.py:parse_message_id: UnblondLocalError

2019-12-22 Thread Drew DeVault


New submission from Drew DeVault :

File "/usr/lib/python3.8/site-packages/emailthreads/threads.py", line 14, in 
get_message_by_id
if msg["message-id"] == msg_id:
  File "/usr/lib/python3.8/email/message.py", line 391, in __getitem__
return self.get(name)
  File "/usr/lib/python3.8/email/message.py", line 471, in get
return self.policy.header_fetch_parse(k, v)
  File "/usr/lib/python3.8/email/policy.py", line 163, in header_fetch_parse
return self.header_factory(name, value)
  File "/usr/lib/python3.8/email/headerregistry.py", line 602, in __call__
return self[name](name, value)
  File "/usr/lib/python3.8/email/headerregistry.py", line 197, in __new__
cls.parse(value, kwds)
  File "/usr/lib/python3.8/email/headerregistry.py", line 530, in parse
kwds['parse_tree'] = parse_tree = cls.value_parser(value)
  File "/usr/lib/python3.8/email/_header_value_parser.py", line 2116, in 
parse_message_id
message_id.append(token)

--
components: Library (Lib)
messages: 358794
nosy: ddevault
priority: normal
severity: normal
status: open
title: email/_header_value_parser.py:parse_message_id: UnblondLocalError
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



[issue39075] types.SimpleNamespace should preserve attribute ordering (?)

2019-12-22 Thread hai shi


hai shi  added the comment:

@Raymond OK, copy that.

--

___
Python tracker 

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



[issue39060] asyncio.Task.print_stack doesn't print the full stack

2019-12-22 Thread Amit Itzkovitch


Amit Itzkovitch  added the comment:

Hi Terry,
I guess the right place to update the Task.get_stack doc: 
https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.get_stack

I'm not sure I know the terminology enough to phrase it right, but I would add 
there something like:
Note that the task's stack does not include the stack of coroutines that were 
awaited inside the task, as it is not part of the Task itself. 

But I am sure one of you can phrase it more professionally than me :)

--

___
Python tracker 

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



[issue39118] Variables changing values on their own

2019-12-22 Thread Mark Dickinson


Mark Dickinson  added the comment:

This isn't a bug. After this line in your code:

   o = x

both o and x refer to the same list object. So any modification you make to 
that list through the name "x" (for example, x[i][n]+=y[i][n]) will be seen 
through the name "o" as well.

There's lots written elsewhere explaining Python's assignment semantics. I 
highly recommend this presentation by Ned Batchelder: 
https://nedbatchelder.com/text/names1.html

You can also ask further questions on the Python mailing list: 
https://mail.python.org/mailman/listinfo/python-list

Closing here.

--
nosy: +mark.dickinson
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



[issue39118] Variables changing values on their own

2019-12-22 Thread Leonardo


New submission from Leonardo :

in this code the variable o changes on its own:

x=[[-1, 7, 3], [12, 2, -13], [14, 18, -8], [17, 4, -4]]
x1=[[-8, -10, 0], [5, 5, 10], [2, -7, 3], [9, -8, -3]]
y=[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]
k=True
f=0
z=[]
d=[]
while k:
print(k)
o=x
print(o)
for i in range(len(x)):
for n in range(len(x)):
if i!=n:
for g in range(3):
if x[i][g]>x[n][g]:
y[i][g]-=1
if x[i][g]

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



[issue36788] Add clamp() function to builtins

2019-12-22 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Maybe port this discussion over python-ideas and after the resolution open it 
> again?

Sounds good to me. Adding a new builtin function is a big deal that would 
likely need a PEP. I'm not keen on adding something like this to the math 
module, either, when it's so simple to construct from max and min.

Closing as rejected here; it can be re-opened if there's a strong consensus for 
adding it on the ideas list.

--
nosy: +mark.dickinson
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



[issue11416] netrc module does not handle multiple entries for a single host

2019-12-22 Thread Tibor Baranya


Tibor Baranya  added the comment:

As I understand this issue is there up to 3.8 (and will live into 3.9). As 
urllib3 supports netrc and requests uses urllib3, this issue can potentially 
cause a lot of inconsistencies. In case of multile entries (with no user 
provided), curl and wget takes the first entry, while cpython netrc takes the 
last.
I see there is a proposed implementation, but I couldn't find it's pull request 
on github. Is there any chance this will be resolved in the near future?
Alternatively, I can create a pull request, but I only bother if there is an 
actual intention to fix the current behavior.

--
nosy: +arsyee
versions: +Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-22 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset eae87e3e4e0cb9a0ce10c2e101acb6995d79e09c by Ivan Levkivskyi (Bar 
Harel) in branch 'master':
bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336)
https://github.com/python/cpython/commit/eae87e3e4e0cb9a0ce10c2e101acb6995d79e09c


--

___
Python tracker 

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



[issue39075] types.SimpleNamespace should preserve attribute ordering (?)

2019-12-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

@haisai SimpleNamespace can't use keyword arguments because those are already 
used to pass in data.  Also, we want to keep it simple; hence, the name :-)

--

___
Python tracker 

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