[issue36048] Deprecate implicit truncating when convert Python numbers to C integers

2019-02-20 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

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

2019-02-20 Thread Aaryn Tonita
Aaryn Tonita added the comment: Hi David, the problem is in email._header_value_parser._refold_parse_tree. Specifically, when the parsetree renders too long, it recursively gets newparts = list(part) (the children). When it does this to a BareQuotedString node, the child nodes are unquoted a

[issue36048] Deprecate implicit truncating when convert Python numbers to C integers

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Numerous explicit calls of PyNumber_Index() which are used to protect from passing non-integral types to PyLong_AsLong() and like can be removed after the end of the deprecation period. I tried to mark calls which can be removed with comments, but virtuall

[issue36047] socket file handle does not support stream write

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: I confirm that you don't use socket.makefile in write mode. Python 3.7.2 (default, Jan 16 2019, 19:49:22) [GCC 8.2.1 20181215 (Red Hat 8.2.1-6)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> s = socket.s

[issue35810] Object Initialization does not incref Heap-allocated Types

2019-02-20 Thread Eddie Elizondo
Eddie Elizondo added the comment: Bump to get a review on the PR: https://github.com/python/cpython/pull/11661. I believe all comments have now been addressed as well as adding a porting to 3.8 guide. -- ___ Python tracker

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Zahash Z
New submission from Zahash Z : There is no __repr__() method for the PriorityQueue class and LifoQueue class in the queue.py file This makes it difficult to check the elements of the queue. -- messages: 336053 nosy: Zahash Z priority: normal severity: normal status: open title: No __r

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: but the __repr__ would have a limitation because you can't show all the elements from your queue, for example, if your queue contains 1000 items, the __repr__ will show the total items or just the ten first ones? We need a compromise for that. -- no

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: and there is an other issue, we need to iterate over the elements of the deque() :/ not really performant, just for a repr(). for my part, -1 if we have to iterate over the elements. -- ___ Python tracker

[issue35925] test_httplib test_nntplib test_ssl fail on ARMv7 Debian buster bot (OpenSSL 1.1.1a)

2019-02-20 Thread Charalampos Stratakis
Charalampos Stratakis added the comment: SSLContext.minimum_version is added here on the master branch: https://github.com/python/cpython/commit/698dde16f60729d9e3f53c23a4ddb8e5ffe818bf But I'd be also reluctant to partially backport a new feature to fix the test suite. --

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Windson Yang
Windson Yang added the comment: Hello, Zahash Z. May I ask what is your expected behavior for the return value of __repr__() from PriorityQueue. I'm agreed with Stéphane Wirtel, I don't think returning all the items would be a good idea, maybe we can improve it in another way. For instance, r

[issue36042] Setting __init_subclass__ and __class_getitem__ methods are in runtime doesnt make them class method.

2019-02-20 Thread INADA Naoki
INADA Naoki added the comment: __new__ is special function too. It is converted as staticmethod when class creation. Since manually converting to (static|class)method is allowed, I don't think automatic conversion should be applied when attach after class creation. $ python3 Python 3.7.2 (d

[issue10278] add time.monotonic() method

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: This issue has been followed by the PEP 418 which added time.monotonic(), time.perf_counter() and time.process_time(). -- title: add time.wallclock() method -> add time.monotonic() method ___ Python tracker

[issue23428] Use the monotonic clock for thread conditions on POSIX platforms

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: INADA-san fixed bpo-12822 with: New changeset 001fee14e0f2ba5f41fb733adc69d5965925a094 by Inada Naoki in branch 'master': bpo-12822: use monotonic clock for condvar if possible (GH-11723) https://github.com/python/cpython/commit/001fee14e0f2ba5f41fb733adc69d5

[issue12822] NewGIL should use CLOCK_MONOTONIC if possible.

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: Thanks INADA-san for fixing this old issue! -- ___ Python tracker ___ ___ Python-bugs-list mailin

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: >>> from collections import deque >>> d = deque() >>> d.append('j') >>> d.appendleft('f') >>> d deque(['f', 'j']) >>> repr(d) "deque(['f', 'j'])" Maybe there is a solution, in the code of deque_repr, we convert the deque to a list. We could do the same thing

[issue36031] add internal API function to effectively convert just created list to tuple

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: _PyList_ConvertToTuple(PyObject *v): assert(Py_REFCNT(v) == 1); I don't think that _PyList_ConvertToTuple() usage is common enough to justify this micro-optimization. IMHO "Py_REFCNT(v) == 1" assumption is too strong. Python internals can be very surpri

[issue35840] Control flow inconsistency on closed asyncio stream

2019-02-20 Thread Emmanuel Arias
Change by Emmanuel Arias : -- nosy: +eamanu ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: > >>> os.startfile('file:///C:/Temp/test/test.exe') Oh, startfile() also runs a program for an URL using file:// scheme? If yes, it becomes even more complex to fix this file :-/ How do you decide if an URL start with file:// is safe? -- __

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

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: Raymond: > Also, the timing loop is unrealistic. We mostly care about small tuples. Sergey: can you please run benchmarks on small tuples? Example, 1, 5, 10, 20 and 100 items. Maybe not only tuple(list), but try some other operations? -- __

[issue35812] Don't log an exception from the main coroutine in asyncio.run()

2019-02-20 Thread Emmanuel Arias
Change by Emmanuel Arias : -- nosy: +eamanu ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: For this script, you could have the following output: from queue import Queue q = Queue() print(repr(q)) q.put('a') print(repr(q)) q.put('b') print(repr(q)) q.put('c') print(repr(q)) Queue() Queue('a') Queue('a','b') Queue('a'...'c') -- ___

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: New output for Queue, PriorityQueue and LifoQueue Queue() Queue('a') Queue('a','b') Queue('a'...'c') PriorityQueue() PriorityQueue('a') PriorityQueue('a','b') PriorityQueue('a'...'c') LifoQueue() LifoQueue('a') LifoQueue('a','b') LifoQueue('a'...'c') ---

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Change by Stéphane Wirtel : -- keywords: +patch pull_requests: +11978 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Just created a PR for this issue and I need to add the tests for the __repr__ method -- ___ Python tracker ___ _

[issue36048] Deprecate implicit truncating when convert Python numbers to C integers

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: I like the idea. Rejecting float but not decimal.Decimal is inconsistent. __index__ has been written explicitly for this purpose. I'm always confused and lost in subtle details of the Python and C API in how they handle numbers, so I wrote some notes for mys

[issue34486] "RuntimeError: release unlocked lock" when starting a thread

2019-02-20 Thread Radek
Radek added the comment: Any progress on this topic? I think I've encountered this (or similar) issue: >Traceback (most recent call last): > File "logging/__init__.py", line 1944, in shutdown > File "logging/__init__.py", line 813, in acquire > File "site-packages/utils/signals.py", line 58

[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2019-02-20 Thread STINNER Victor
Change by STINNER Victor : -- title: Deprecate implicit truncating when convert Python numbers to C integers -> Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__ ___ Python tracker

[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-34423: "Overflow when casting from double to time_t, and_PyTime_t" or "How to reduce precision loss when converting arbitrary number to int or float?". -- ___ Python tracker

[issue34423] Overflow when casting from double to time_t, and_PyTime_t.

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-36048: "Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__". -- ___ Python tracker ___

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

2019-02-20 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +11979 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Zahash Z
Zahash Z added the comment: I raised this issue after creating a pull request and modifying the source code. so, people who want to create a pull request can sit back and relax cuz I got this -- ___ Python tracker

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Roundup Robot
Change by Roundup Robot : -- pull_requests: +11980 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

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

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: I prefer PyTuple_FromArray() API idea. It's safer by design than you "list to tuple" function stealing references to list items if refcnt(list)==1. -- ___ Python tracker __

[issue22213] Make pyvenv style virtual environments easier to configure when embedding Python

2019-02-20 Thread INADA Naoki
Change by INADA Naoki : -- nosy: +inada.naoki ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi @matrixise, is it really an issue to iterate over all the elements of the deque? __repr__ won't be called on performance sensitive path and we already do this for repr([0]*1), repr({i for i in range(1)}) and repr({i:i for i in range(1)})

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Yep, we have a problem, two PRs for the same issue. I have seen your issue in the bug tracker (not marked as "in progress") and I started to fix it where I have proposed some solutions and a PR. For the next time, maybe you should create the issue, indicate

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: @remi.lapeyre In fact, I am not sure about the performance issue but in the code of _collectionsmodule.c#deque_repr we create a PySequence_List, it's a new list. So for me, but maybe I am wrong, we will iterate over the deque container for the creation of t

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: static PyObject * deque_repr(PyObject *deque) { PyObject *aslist, *result; ... aslist = PySequence_List(deque); ... if (((dequeobject *)deque)->maxlen >= 0) result = PyUnicode_FromFormat("%s(%R, maxlen=%zd)",

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Windows has the GetBinaryTypeW function, this one is used by pywin32, maybe I could develop a wrapper in os, like os.is_executable(path) for Unix-like, os.is_executable(path) could use os.access(path, os.X_OK) for Windows, the function would use GetBinaryType

[issue36020] HAVE_SNPRINTF and MSVC std::snprintf support

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Hi @steve I'm not used to this, can you guide me? Thanks -- ___ Python tracker ___ ___ Python-bu

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Zahash Z
Change by Zahash Z : -- components: +Library (Lib) ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue36050] Why does http.client.HTTPResponse._safe_read use MAXAMOUNT

2019-02-20 Thread Bruce Merry
New submission from Bruce Merry : While investigating poor HTTP read performance I discovered that reading all the data from a response with a content-length goes via _safe_read, which in turn reads in chunks of at most MAXAMOUNT (1MB) before stitching them together with b"".join. This can re

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

2019-02-20 Thread Bruce Merry
New submission from Bruce Merry : A common pattern in libraries doing I/O is to receive data in chunks, put them in a list, then join them all together using b"".join(chunks). For example, see http.client.HTTPResponse._safe_read. When the output is large, the memory copies can block the inter

[issue35993] incorrect use of released memory in Python/pystate.c line 284

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: @eric Could you help me for the tests of my PR? Thank you -- nosy: +eric.snow ___ Python tracker ___ ___

[issue35995] use SSL encrypted socket on logging.handlers.SMTPHandler

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: @lidayan I think it's a misuse of the logging.handlers.SMTPHandler class. -- ___ Python tracker ___

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Note: when repr do not round trip, I think it's common practice to use brackets: instead of: LifoQueue('a'...'c') Example with Regex from https://docs.python.org/3/howto/regex.html: >>> re.match(r'From\s+', 'From amk Thu May 14 19:12:10 1998')

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Fixed -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

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

2019-02-20 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

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

2019-02-20 Thread SilentGhost
Change by SilentGhost : -- title: (Performance) Drop the GIL during large bytes.join operations? -> Drop the GIL during large bytes.join operations? type: -> performance versions: +Python 3.8 -Python 3.7 ___ Python tracker

[issue35993] incorrect use of released memory in Python/pystate.c line 284

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: New changeset b5409dacc4885146a27d06482b346e55fa12d2ec by Victor Stinner (Stéphane Wirtel) in branch 'master': bpo-35993: Fix _PyInterpreterState_DeleteExceptMain() (GH-11852) https://github.com/python/cpython/commit/b5409dacc4885146a27d06482b346e55fa12d2ec

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: See also https://bugs.python.org/issue35889 which add repr to sqlite3.Row -- ___ Python tracker ___

[issue35993] incorrect use of released memory in Python/pystate.c line 284

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: Thanks wangjiangqiang for the bug report and thanks Stéphane Wirtel for the fix! -- components: +Interpreter Core resolution: -> fixed stage: -> resolved status: open -> closed versions: +Python 3.8 ___ Python trac

[issue34464] There are inconsitencies in the treatment of True, False, None, and __debug__ keywords in the docs

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Hi @David, Maybe we could remove 3.6 from the list because 3.6 is in security mode and not bugfix. Is there a security issue with this bug? -- nosy: +matrixise ___ Python tracker

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: > Windows has the GetBinaryTypeW function, this one is used by pywin32, maybe I > could develop a wrapper in os, like os.is_executable(path) I don't think that it would detect .BAT or .VBS scripts as executable, whereas we don't want to execut such scripts w

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Sure we don't want to execute these kinds of scripts but we could mix with GetBinaryTypeW and add a check on the extensions. for example and simplified protocode if is_executable(path) or is_script(path): raise ... os.startfile(path) --

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

2019-02-20 Thread R. David Murray
R. David Murray added the comment: I'm afraid I don't have time to parse through the file you uploaded. Can you produce a pull request or a diff showing your fix? And ideally some added tests :) But whatever you can do is great, if you don't have time maybe someone else will pick it up (I

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: > Sure we don't want to execute these kinds of scripts but we could mix with > GetBinaryTypeW and add a check on the extensions. Windows has a convenient feature: if you ask to run "program", Windows tries to run "program.exe", "program.bat", etc. Example:

[issue36035] pathlib.Path().rglob() breaks with broken symlinks

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: 3.5 is in security mode, we can remove 3.5 from the list for this issue. -- versions: -Python 3.5 ___ Python tracker ___ ___

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread STINNER Victor
STINNER Victor added the comment: Maybe webbrowser must be changed to become *very strict*. For example, raise an error if the URL doesn't start with "http://"; or "https://";. But add an option to opt-in for "unsafe" URLs with a warning in the doc to explain the risk on Windows? Another op

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: +1 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread Eryk Sun
Eryk Sun added the comment: > Windows has the GetBinaryTypeW function ShellExecute[Ex] doesn't check for a PE image. It uses the file extension, and a tangled web of registry settings to determine what to execute. If a file should run directly via CreateProcess, you'll find the template comm

[issue34464] There are inconsitencies in the treatment of True, False, None, and __debug__ keywords in the docs

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: __debug__ is not a keyword. And the error message has been changed in 3.8. But it is a special enough. You can not use this name in any assignment context: >>> __debug__ = 1 File "", line 1 SyntaxError: cannot assign to __debug__ >>> for __debug__ in []:

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : All ways of assigning to __debug__ are forbidden: >>> __debug__ = 1 File "", line 1 SyntaxError: cannot assign to __debug__ >>> for __debug__ in []: pass ... File "", line 1 SyntaxError: cannot assign to __debug__ >>> with cm() as __debug__: pass ...

[issue35933] python doc does not say that the state kwarg in Pickler.save_reduce can be a tuple (and not only a dict)

2019-02-20 Thread Pierre Glaser
Change by Pierre Glaser : -- keywords: +patch pull_requests: +11981 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-l

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread Steve Dower
Steve Dower added the comment: > Maybe webbrowser must be changed to become *very strict*. This is the only acceptable suggestion I've seen (since my suggestion ;) ) I'd propose making it very strict by *requiring* a browser to be detected. So remove the os.startfile default and always requi

[issue35933] python doc does not say that the state kwarg in Pickler.save_reduce can be a tuple (and not only a dict)

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: A slotted class will have a dict also when it inherits it from a non-slotted class. This is why the base class of slotted class should have slots if you do not want an instance dict. __getstate__ and __setstate__ for slotted classes are described in PEP 30

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You need to add for the target of the assignment operator the same check as for other targets. -- ___ Python tracker ___ _

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: An idea for the fix? a direction where I could find the solution? ;-) -- nosy: +matrixise ___ Python tracker ___

[issue35933] python doc does not say that the state kwarg in Pickler.save_reduce can be a tuple (and not only a dict)

2019-02-20 Thread Pierre Glaser
Pierre Glaser added the comment: I added a PR with a small patch to document this behavior and reconcile _pickle.c and pickle.py Some explanations on why I am pushing this forward: Pickling instances of classes/subclasses with slots is done natively for pickle protocol >= 2. Mentioning thi

[issue35933] python doc does not say that the state kwarg in Pickler.save_reduce can be a tuple (and not only a dict)

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue26579 which propose to add a function or method for standard implementation of __getstate__ and use it consistently in custom __getstate__ implementations. I am not sure about API yet. -- ___ Pytho

[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I am not sure what to with the int constructor. Should it try __index__ before __int__? Or just make __index__ without __int__ setting the nb_int slot as was proposed by Nick in issue33039? -- ___ Python tracker

[issue36000] __debug__ is a keyword but not a keyword

2019-02-20 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

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

2019-02-20 Thread Aaryn Tonita
Aaryn Tonita added the comment: Sure thing, I'll try to produce something tomorrow. -- ___ Python tracker ___ ___ Python-bugs-list

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: ok, I will check for the assignment operator in the code. maybe in the AST (Python-ast.c) but I think not -- ___ Python tracker ___

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: ok, I found the commit of @emily 8f59ee01be3d83d5513a9a3f654a237d77d80d9a and will try to find the assignment operator := -- ___ Python tracker

[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.pah

2019-02-20 Thread Piotr Karkut
New submission from Piotr Karkut : When walk_packages encounter a package with a name that is available in sys.path, it will abandon the current package, and start walking the package from the sys.path. Consider this file layout: ``` PYTHONPATH/ ├──package1/ | ├──core | | ├──some_pac

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Emily Morehouse
Emily Morehouse added the comment: You should look in Python/ast.c. The naming convention follows some form of "named expression" (e.g. NamedExpr, ast_for_namedexpr). I'll have more time to look later this week, but let me know if you have any questions. --

[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-02-20 Thread Piotr Karkut
Change by Piotr Karkut : -- title: pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.pah -> pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path ___ Python tr

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Hi @emily Thank you for your help. In fact, I have started to read Python-ast.c and ast.c, they are the main files for this kind of operations. Thank you again, -- ___ Python tracker

[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-02-20 Thread Piotr Karkut
Change by Piotr Karkut : -- keywords: +patch pull_requests: +11982 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-li

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I guess you hurried to write the code. It has not yet been decided whether to expose the content of the queue in its repr at all. There is no public API for accessing the content of the queue without removing items from the queue, and I think it is intenti

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Stéphane Wirtel
Change by Stéphane Wirtel : -- assignee: -> matrixise ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Look at compile.c. The code for restricting other assignments is located here. -- ___ Python tracker ___ __

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Zahash Z
Zahash Z added the comment: If you look at the queue.PriorityQueue class, there is self.queue = [ ]. That's because priority queue uses list data structure to implement the min heap data structure (on which priority queue is based on). So the list can be represented. There is no need to remov

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- keywords: +patch pull_requests: +11984 stage: -> patch review ___ Python tracker ___ ___ Pytho

[issue36054] Way to detect CPU count inside docker container

2019-02-20 Thread Keir Lawson
New submission from Keir Lawson : There appears to be no way to detect the number of CPUs allotted to a Python program within a docker container. With the following script: import os print("os.cpu_count(): " + str(os.cpu_count())) print("len(os.sched_getaffinity(0)): " + str(len(os.sched_get

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Zahash Z] (Zahash Z)] > If you look at the queue.PriorityQueue class, there is > self.queue = [ ]. We really don't want to expose the internals here. They are subject to change and access to them is guarded by locks. > It has not yet been decided wheth

[issue35956] Sort documentation could be improved for complex sorting

2019-02-20 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Pyt

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Stéphane Wirtel
Change by Stéphane Wirtel : -- pull_requests: +11985 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: When I started working on this I did not notice the extra comments here. I will close my PR so Stéphane can do the PR. -- nosy: +pablogsal ___ Python tracker ___

[issue36039] Replace append loops with list comprehensions

2019-02-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: I concur with all the other -1 comments and will mark this a closed. FWIW, we generally discourage sweeping across the library with minor rewrites. Guido articulated a principle of "holistic refactoring" where we make code improvements while working on t

[issue36042] Setting __init_subclass__ and __class_getitem__ methods are in runtime doesnt make them class method.

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't like complicating the code and adding a performance penalty to support such uncommon case. The documentation for __class_getitem__ precisely describes the current behavior: "when defined in the class body, this method is implicitly a class method"

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Hi @rhettinger Thank you for the review of this issue. -- resolution: rejected -> stage: resolved -> patch review status: closed -> open ___ Python tracker ___

[issue36042] Setting __init_subclass__ and __class_getitem__ methods are in runtime doesnt make them class method.

2019-02-20 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: I totally agree with Serhiy -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue36052] Assignment operator allows to assign to __debug__

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Thank you Pablo, if I see you at PyCon, maybe we could drink a good beer ;-) -- ___ Python tracker ___ __

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you treat the "queue" attribute as a part the public API, just use repr(q.queue) instead of repr(q). -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue36054] Way to detect CPU count inside docker container

2019-02-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: I would like to work on this issue. -- nosy: +matrixise ___ Python tracker ___ ___ Python-bugs-li

[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2019-02-20 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: > I am not sure what to with the int constructor. Should it try __index__ > before __int__? Or just make __index__ without __int__ setting the nb_int > slot as was proposed by Nick in issue33039? Shouldn't it try only __int__ since this will default to __index_

  1   2   >