Re: help on "from deen import *" vs. "import deen"

2016-11-14 Thread jfong
MRAB at 2016/11/15 11:31:41AM wrote: > When you say "from deen import *" you're copying names and their > references from the module's namespace to your local namespace: > > [module deen] [locally] > > tblm > [0, 0, 0] <-

[issue28670] PEP 235: Implement on every POSIX system, and clean up the C code for `import'

2016-11-14 Thread Michael Witten
Michael Witten added the comment: Thank you for the reply. * As already stated, I believe that Python 3 is not affected by this problem; certainly, version 3.5.2 does not seem to be affected, as per my ad hoc testing. * Very many programs are targeted to Python 2.7, and probably will

Re: Who owns the memory in ctypes?

2016-11-14 Thread eryk sun
On Tue, Nov 15, 2016 at 3:15 AM, Cem Karan wrote: > if my C code allocates memory via GC_MALLOC() (the standard call for > allocating memory > in the garbage collector), and I access some object via ctypes in python, > will the python > garbage collector assume that it owns

Re: Access to the caller's globals, not your own

2016-11-14 Thread Dan Sommers
On Mon, 14 Nov 2016 16:20:49 +1100, Steven D'Aprano wrote: > import library > SPAMIFY = False # only affects this module, no other modules > result = library.make_spam(99) I must be missing something, because it seems too obvious: import library # only affects this module, no other

[issue28694] tkinter interface to fontchooser

2016-11-14 Thread Terry J. Reedy
Terry J. Reedy added the comment: https://www.tcl.tk/man/tcl/TkCmd/fontchooser.htm I agree that this should be wrapped, as is colorchooser. There are a few details that may need to be thrashed out. It is a nuisance that the native font dialog is modal on Windows and not on Mac (and ??? on

[issue28694] tkinter interface to fontchooser

2016-11-14 Thread Zachary Ware
Zachary Ware added the comment: You've already done the proposing part by opening this issue ;). To contribute you work, attach it here as a patch to the tkinter sources found in Lib/tkinter/ of a cpython source checkout. You'll need to sign a contributor agreement before we can look at or

[issue28666] Make test.support.rmtree() able to remove non-writable directories

2016-11-14 Thread Kushal Das
Kushal Das added the comment: The patch looks good to me. This can be applied, and tests are running fine with the patch. https://ci.centos.org/job/cPython-build-patch/25/console -- nosy: +kushal.das ___ Python tracker

Re: help on "from deen import *" vs. "import deen"

2016-11-14 Thread MRAB
On 2016-11-15 01:36, jf...@ms4.hinet.net wrote: Ned Batchelder at 2016/11/15 6:33:54AM wrote: > But I get a wrong answer this way: > >>> from deen import * > >>> tblm = tbli > >>> gpa(0x7d) > 125 # it's 0x7d, the tblm[2] is 0 > > Why? why! why:-( Here you are assigning a value to your own

Who owns the memory in ctypes?

2016-11-14 Thread Cem Karan
Hi all, I'm hoping that this will be an easy question. I have a pile of C code that I wrote that I want to interface to via the ctypes module (https://docs.python.org/3/library/ctypes.html). The C code uses the Boehm-Demers-Weiser garbage collector (http://www.hboehm.info/gc/) for all of its

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-14 Thread Xiang Zhang
Xiang Zhang added the comment: Maybe you have forgotten to remove the debug print in the patch? -- nosy: +xiang.zhang ___ Python tracker ___

[issue28694] tkinter interface to fontchooser

2016-11-14 Thread Lance Ware
New submission from Lance Ware: Tcl/Tk 8.6 now has a fontchooser command. I have developed a tkinter interface to it, similar to colorchooser/askcolor. How does one go about contributing this or proposing for future enhancement to the tkinter module suite? -- components: Tkinter

[issue28573] Python 3.6.0b3 64-bit has no sys._mercurial info

2016-11-14 Thread Steve Dower
Changes by Steve Dower : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___

[issue28573] Python 3.6.0b3 64-bit has no sys._mercurial info

2016-11-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset d997e64130bd by Steve Dower in branch '3.6': Issue #28573: Fixes issue with nested if blocks https://hg.python.org/cpython/rev/d997e64130bd New changeset 35f510158490 by Steve Dower in branch 'default': Issue #28573: Fixes issue with nested if

Re: help on "from deen import *" vs. "import deen"

2016-11-14 Thread jfong
Ned Batchelder at 2016/11/15 6:33:54AM wrote: > > But I get a wrong answer this way: > > >>> from deen import * > > >>> tblm = tbli > > >>> gpa(0x7d) > > 125 # it's 0x7d, the tblm[2] is 0 > > > > Why? why! why:-( > > Here you are assigning a value to your own tblm, not deen.tblm, > so gpa does

[issue28573] Python 3.6.0b3 64-bit has no sys._mercurial info

2016-11-14 Thread Steve Dower
Steve Dower added the comment: I suspect this is because my PATH was getting too long within my build script because of setting up the VS build environment too many times (if PATH gets too long then new processes may ignore or truncate it). The commit should cut this down to the point where

[issue28573] Python 3.6.0b3 64-bit has no sys._mercurial info

2016-11-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 25cb7df5b19d by Steve Dower in branch '3.6': Issue #28573: Avoid setting up env too many times during build https://hg.python.org/cpython/rev/25cb7df5b19d New changeset ae8f525cef2a by Steve Dower in branch 'default': Issue #28573: Avoid setting up

[issue28670] PEP 235: Implement on every POSIX system, and clean up the C code for `import'

2016-11-14 Thread Brett Cannon
Brett Cannon added the comment: Because this would be a feature change in Python 2.7 it can't go in there. This could potentially go into 3.7 if it's deemed useful. As for why the code review tool isn't picking up your uploads, it's because we work in patch files and not patch sets. See

Re: help on "from deen import *" vs. "import deen"

2016-11-14 Thread Ned Batchelder
On Sunday, November 13, 2016 at 9:39:12 PM UTC-5, jf...@ms4.hinet.net wrote: > Running the following codes (deen.py) under Win32 python 3.4.4 terminal: > > tbli = [0x66, 0x27, 0xD0] > tblm = [0 for x in range(3)] > def gpa(data): > td = data ^ tblm[2] > return td The function gpa

[issue28670] PEP 235: Implement on every POSIX system, and clean up the C code for `import'

2016-11-14 Thread Brett Cannon
Changes by Brett Cannon : -- stage: -> test needed ___ Python tracker ___ ___

[issue28685] Optimizing list.sort() by performing safety checks in advance

2016-11-14 Thread Elliot Gorokhovsky
Elliot Gorokhovsky added the comment: On Mon, Nov 14, 2016 at 10:32 AM STINNER Victor wrote: > You can use perf timeit --compare-to to check if the result is significant > or not, and it displays you the "N.NNx faster" or "N.NNx slower" if it's > significant. > Will do

Lexer/Parser question: TPG

2016-11-14 Thread Johannes Bauer
Hi group, this is not really a Python question, but I use Python to lex/parse some input. In particular, I use the amazing TPG (http://cdsoft.fr/tpg/). However, I'm now stuck at a point and am sure I'm not doing something correctly -- since there's a bunch of really smart people here, I hope to

[issue28690] Loop in re (regular expression) processing

2016-11-14 Thread Walter Farrell
Walter Farrell added the comment: Thanks, Gareth. That does work. Interesting that regex does still seem to work linearly with the original version, but your version seems cleaner. On Mon, Nov 14, 2016 at 3:55 PM, Gareth Rees wrote: > > Gareth Rees added the comment:

[issue28690] Loop in re (regular expression) processing

2016-11-14 Thread Gareth Rees
Gareth Rees added the comment: This is a well-known gotcha with backtracking regexp implementations. The problem is that in the alternation "( +|'[^']*'|\"[^\"]*\"|[^>]+)" there are some characters (space, apostrophe, double quotes) that match multiple alternatives (for example a space

[issue24117] Wrong range checking in GB18030 decoder.

2016-11-14 Thread Mingye Wang
Mingye Wang added the comment: Just FYI, cp950 0xC6A1 (\uf6b1) is found in current WindowsBestFit: ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit950.txt -- nosy: +Artoria2e5 ___ Python tracker

Fwd: Problems with Anaconda and Pyzo

2016-11-14 Thread Dan Pineau
Hello, I'm a french student and I'm running Python 3.5.2 on windows. When I installed Anaconda3 4.2.0 version, Pyzo couldn't find a module named conda. Then I registered it as my default Python 3.5.2 version, but I couldn't use Pyzo anymore (I sent you a screenshot). So I tried to fix this

[issue28693] No HKSCS support in Windows cp950

2016-11-14 Thread Mingye Wang
New submission from Mingye Wang: Python's cp950 implementation lacks support for HKSCS ('big5hkscs'). This support, which maps HKSCS Big5-EUDC code points to Unicode PUA code points algorithmically, is found in Windows Vista+ as well as an update for XP. An experiment session is shown below.

Re: Access to the caller's globals, not your own

2016-11-14 Thread ojacobson
On Monday, November 14, 2016 at 12:21:00 AM UTC-5, Steven D'Aprano wrote: > Don't tell me to make SPAMIFY a parameter of the function. I know that. > That's > what I would normally do, but *occasionally* it is still useful to have a > global configuration setting, and those are the cases I'm

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry. Here is a patch. -- keywords: +patch Added file: http://bugs.python.org/file45485/gettext-non-int-plural-deprecate.patch ___ Python tracker

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread Paul Moore
Paul Moore added the comment: I agree that the docs are a little confusing on this. Having said that, though, I'm not entirely sure the behaviour needs fixing. The scenario where there's a problem is: 1. User has written a script that needs Python 3 and won't run with Python 2. 2. User does

[issue19717] resolve() fails when the path doesn't exist

2016-11-14 Thread Steve Dower
Changes by Steve Dower : -- status: open -> closed ___ Python tracker ___ ___

[issue19717] resolve() fails when the path doesn't exist

2016-11-14 Thread Steve Dower
Changes by Steve Dower : -- stage: commit review -> resolved ___ Python tracker ___

[issue27854] Installed 2.7: IDLE Help disabled because help.html is missing

2016-11-14 Thread Steve Dower
Steve Dower added the comment: I ran a build and the file is included now. I didn't test an install or the functionality from IDLE, so make sure you cover that with the RC (and since there won't be an RC with a release blocker open, I'll resolve this and we can reactivate if there are new

[issue28635] Update What's New for 3.6

2016-11-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 993215342a95 by Yury Selivanov in branch '3.6': Issue #28635: what's new in 3.6: add a few more notes on typing https://hg.python.org/cpython/rev/993215342a95 New changeset c3b4eea73615 by Yury Selivanov in branch 'default': Merge 3.6 (issue

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-14 Thread Julien Palard
Julien Palard added the comment: Hi, did you forget to attach the patch? -- nosy: +mdk ___ Python tracker ___

Re: Why does this list swap fail?

2016-11-14 Thread Rob Gaddi
38016226...@gmail.com wrote: > L=[2,1] > L[0],L[L[0]-1]=L[L[0]-1],L[0] > > The L doesn't change. Can someone provide me the detail procedure of this > expression? Better question: Why does that list swap exist? If you're just trying to put the language through its paces that's one thing, but I

Re: Why does this list swap fail?

2016-11-14 Thread Alain Ketterlin
38016226...@gmail.com writes: > L=[2,1] > L[0],L[L[0]-1]=L[L[0]-1],L[0] > > The L doesn't change. Can someone provide me the detail procedure of > this expression? From: https://docs.python.org/3/reference/simple_stmts.html#grammar-token-assignment_stmt | Although the definition of assignment

Re: Why does this list swap fail?

2016-11-14 Thread Jussi Piitulainen
38016226...@gmail.com writes: > L=[2,1] > L[0],L[L[0]-1]=L[L[0]-1],L[0] > > The L doesn't change. Can someone provide me the detail procedure of > this expression? The right-hand side evaluates to (1,2), but then the assignments to the targets on the left-hand side are processed in order from

[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is my fault. Proposed patch adds tests for the "error" action. -- components: +Interpreter Core nosy: +serhiy.storchaka stage: -> patch review type: -> crash Added file: http://bugs.python.org/file45484/test_eval_str_invalid_escape_error.patch

Why does this list swap fail?

2016-11-14 Thread 380162267qq
L=[2,1] L[0],L[L[0]-1]=L[L[0]-1],L[0] The L doesn't change. Can someone provide me the detail procedure of this expression? -- https://mail.python.org/mailman/listinfo/python-list

[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-14 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: GNU gettext library accepts only integer value for selecting plural form. Python gettext accepts arbitrary numbers. But gettext formulas are not purposed to support non-integer values and can return incorrect result. For example (in Ukrainian): "1

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread wdhwg001
wdhwg001 added the comment: Okay. But somehow I still think the current way of handling shebang is confusing. That makes a python3-only script unable to find a way to use both versioned shebang and virtualenv. Maybe it could be changed to `Command is eligible for path search, or there is no

Re: Access to the caller's globals, not your own

2016-11-14 Thread Rob Gaddi
Steven D'Aprano wrote: > Suppose I have a library function that reads a global configuration setting: > > # Toy example > SPAMIFY = True > def make_spam(n): > if SPAMIFY: > return "spam"*n > else: > return "ham"*n > > > Don't tell me to make SPAMIFY a parameter of the

exit ThreadPoolExecutor immediately

2016-11-14 Thread Atul Johri
I am looking for a way to stop a ThreadPoolExecutor immediately under the assumption that I don't care about what's currently running or pending. ``` limit = 2 executor = ThreadPoolExecutor(10) posts = itertools.islice(mygen(executor=executor, **kwargs), 0, limit) for post in posts: print(post)

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, you are right, the stacklevel should be 4. Thank you for your report and testing Tim. Committed the patch without any deprecation. Will add a deprecation in separate issue. -- stage: patch review -> resolved status: open -> closed

[issue28685] Optimizing list.sort() by performing safety checks in advance

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: Maybe we should investigate more optimizations on specialized lists. PyPy uses a more compact structure for lists of integers for example. Something like compact strings, PEP 393, of Python 3.3, but for lists.

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5b6cde995b3a by Serhiy Storchaka in branch '3.3': Issue #28563: Make plural form selection more lenient and accepting https://hg.python.org/cpython/rev/5b6cde995b3a New changeset 6ca91a14a555 by Serhiy Storchaka in branch '2.7': Issue #28563: Make

[issue28685] Optimizing list.sort() by performing safety checks in advance

2016-11-14 Thread Elliot Gorokhovsky
Elliot Gorokhovsky added the comment: Sure, if it compiles without that def, I'll remove it from the patch. I added it because I did all the development in an extension module, which also included Python.h, but for some reason it gave me a "function implicitly defined" error for using Py_ABS.

[issue28688] Warning -- warnings.filters was modified by test_warnings

2016-11-14 Thread Xiang Zhang
Xiang Zhang added the comment: test___all__ gets the same behaviour. ./python -Werror -m test test___all__ Run tests sequentially 0:00:00 [1/1] test___all__ Warning -- warnings.filters was modified by test___all__ test___all__ failed (env changed) 1 test altered the execution environment:

[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: > By the way, an unit test is missing since the bug was not catched by the test > suite! Lib/test/test_string_literals.py contains an unit test but it changes the warnings filter, so -Werror option is ignored. --

[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: Attached ast.patch fixes the issue: replace the DeprecationWarning with a SyntaxError. Is it the expected behaviour? Is it worth it to chain the two exceptions? -- keywords: +patch Added file: http://bugs.python.org/file45483/ast.patch

[issue28569] mock.attach_mock should work with any return value of patch()

2016-11-14 Thread Andrey Fedorov
Andrey Fedorov added the comment: Here's the full extension of the example from documentation that doesn't seem to handle classes and functions consistently: import mock patches = { 'requests_get': 'requests.get', 'mymodule_Class1': 'mymodule.Class1' } root_mock =

[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: By the way, an unit test is missing since the bug was not catched by the test suite! -- ___ Python tracker ___

[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread STINNER Victor
New submission from STINNER Victor: The issue #28128 (changeset 259745f9a1e4) introduced a DeprecationWarning on invalid Unicode sequence like "\c". When Python is run with -Werror, Python crashs with an assertion error: $ ./python -Werror -c '"\c"' python: Objects/abstract.c:2232:

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-14 Thread Tim Graham
Tim Graham added the comment: Yes, that fixes the second test. Current warning (with stacklevel=3): /home/tim/code/cpython/Lib/gettext.py:454: DeprecationWarning: Plural value must be an integer, got 1.29 tmsg = self._catalog[(msgid1, self.plural(n))] Possibly the stacklevel should instead

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What about following patch? -- Added file: http://bugs.python.org/file45482/gettext-non-integer-plural-2.patch ___ Python tracker

[issue28690] Loop in re (regular expression) processing

2016-11-14 Thread Walter Farrell
New submission from Walter Farrell: Given: pattern = r"(^|[^\\])<(pm [^ ]+( +|'[^']*'|\"[^\"]*\"|[^>]+)+)>" s = "Bain, F. W. " added to the end of s, it returns quickly with a match. Without the ">" it should fail, but instead seems to loop. (If I use the regex module instead of re, it

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-14 Thread Tim Graham
Tim Graham added the comment: Thanks, that does fix that first test. There is one more that still fails: $ python -Wall tests/runtests.py humanize_tests.tests.HumanizeTests.test_i18n_intword Testing against Django installed in '/home/tim/code/django/django' with up to 3 processes Creating

[issue28689] OpenSSL 1.1.0c test failures

2016-11-14 Thread Christian Heimes
Christian Heimes added the comment: OpenSSL upstream bug: https://github.com/openssl/openssl/issues/1919 -- ___ Python tracker ___

[issue28662] catch also PermissionError in tests when spawning a non existent program

2016-11-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1b2b2cb8f962 by Xavier de Gaye in branch '3.6': Issue #28662: Catch PermissionError in tests when spawning a non existent program https://hg.python.org/cpython/rev/1b2b2cb8f962 New changeset c3f7d81d9050 by Xavier de Gaye in branch 'default':

[issue28662] catch also PermissionError in tests when spawning a non existent program

2016-11-14 Thread Xavier de Gaye
Changes by Xavier de Gaye : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___

[issue28689] OpenSSL 1.1.0c test failures

2016-11-14 Thread Christian Heimes
Christian Heimes added the comment: https://github.com/openssl/openssl/commit/122580ef71e4e5f355a1a104c9bfb36feee43759 -- ___ Python tracker ___

[issue28689] OpenSSL 1.1.0c test failures

2016-11-14 Thread Christian Heimes
Christian Heimes added the comment: A git bisect between OpenSSL_1_1_0b (good) and OpenSSL_1_1_0c (bad) revealed the breaking commit: $ git bisect good 122580ef71e4e5f355a1a104c9bfb36feee43759 is the first bad commit commit 122580ef71e4e5f355a1a104c9bfb36feee43759 Author: Matt Caswell

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Proposed patch makes gettext accepting non-integer numbers. But DeprecationWarning is emitted if this number have fractional part (because in this case the result of current code can be different from the result of old code). I think Django tests should be

[issue24339] iso6937 encoding missing

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: Ok. I'm not waiting for a simpler patch reusing existing charmap functions to see the complexity of the codec ;-) -- ___ Python tracker

[issue28688] Warning -- warnings.filters was modified by test_warnings

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: > How you got this warning? I can't reproduce. Sorry, I forgot to mention that the warning only occurs if you run Python with -Werror: @selma$ ./python -Werror -m test test_warnings Run tests sequentially 0:00:00 [1/1] test_warnings Warning --

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-14 Thread Xiang Zhang
Xiang Zhang added the comment: GNU gettext only allows the plural value(n) to be an integer(unsigned long int). Django deliberately converts the value to long in filesizeformat. Any reason not to use int? -- ___ Python tracker

[issue28563] Arbitrary code execution in gettext.c2py

2016-11-14 Thread Tim Graham
Tim Graham added the comment: Hi, this broke a couple tests with Django because it's passing number as a float rather than an integer. For example: == ERROR: test_localized_formats

[issue24339] iso6937 encoding missing

2016-11-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > My rule is more to only added encodings used (in practice) as locale > encodings. Just for reference: issue19459, issue21081, issue22679, issue20087. > @Serhiy: Do you think that the encoding is popular enough to pay the price of its maintainance? Yes,

[issue28689] OpenSSL 1.1.0c test failures

2016-11-14 Thread Christian Heimes
Christian Heimes added the comment: test_server_accept (test.test_ssl.ThreadedTests) ... Exception in thread Thread-348: Traceback (most recent call last): File "/home/heimes/dev/python/cpython/Lib/threading.py", line 916, in _bootstrap_inner self.run() File

[issue28689] OpenSSL 1.1.0c test failures

2016-11-14 Thread Chi Hsuan Yen
Changes by Chi Hsuan Yen : -- nosy: +Chi Hsuan Yen ___ Python tracker ___ ___

[issue28688] Warning -- warnings.filters was modified by test_warnings

2016-11-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: How you got this warning? I can't reproduce. -- ___ Python tracker ___

[issue28689] OpenSSL 1.1.0c test failures

2016-11-14 Thread Christian Heimes
New submission from Christian Heimes: OpenSSL 1.1.0c broke a bunch of tests. The same tests are passing fine with OpenSSL 1.1.0 to 1.1.0b. It looks like a problem with EOF / connection close error. I'm seeing similar problems in MIT KRB5's OpenSSL plugin, too.

[issue28631] [2.7/3.5/3.6 Regression] crash using ctypes

2016-11-14 Thread Matthias Klose
Matthias Klose added the comment: closing -- resolution: -> not a bug status: open -> closed ___ Python tracker ___

[issue28631] [2.7/3.5/3.6 Regression] crash using ctypes

2016-11-14 Thread Stuart Prescott
Stuart Prescott added the comment: Having added the suggested restype (plus a lot of others and also quite a few extra argtypes), we now have code that works across a few different versions of Python once again. Thanks for the hint, eryksun and also thanks to doko for proxying the report and

[issue24339] iso6937 encoding missing

2016-11-14 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 14.11.2016 13:03, STINNER Victor wrote: > > STINNER Victor added the comment: > > iso6937.py: > >> # from utf-8 to iso6937 >> def iso6937_encode(input,errors,encoding_map): > > Wait, is this code for Python 3? Decode from UTF-8 and encode to ISO-6937

[issue28685] Optimizing list.sort() by performing safety checks in advance

2016-11-14 Thread Julien Palard
Julien Palard added the comment: Hi Elliot, nice spot! Why are you redefining Py_ABS, which looks already defined in `pymacro.h` included itself by `Python.h`? I'm not fan of undefining it later, it may surprise someone later expecting it to be there. I tried to compile without your

[issue24339] iso6937 encoding missing

2016-11-14 Thread Julien Palard
Julien Palard added the comment: @Serhiy @haypo: Popular enough or not, it may start as a lib on pypi, we'll see its usage from here. -- ___ Python tracker

[issue24339] iso6937 encoding missing

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: @Serhiy: Do you think that the encoding is popular enough to pay the price of its maintainance? It's already possible to register manually a new encoding in an application. It was even already possible in Python 2.7 (and older). --

[issue28684] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: I suggest to write a decorator in Lib/asyncio/test_utils.py to skip AF_UNIX tests on Android if os.getuid() != 0. Another approach is to catch the PermissionError and re-raises an unittest.SkipTest. Begin by modifying unix_socket_path() context manager in

[issue23839] Clear caches after every test

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: Martin Panter: """ When I run the tests with -Werror (or any other -W option), I now get 2 tests altered the execution environment: test___all__ test_warnings """ I confirm: I opened issue #28688 to track this issue (this issue is now closed). --

[issue28688] Warning -- warnings.filters was modified by test_warnings

2016-11-14 Thread STINNER Victor
New submission from STINNER Victor: The issue #23839 modified the test runner to always clear caches before running tests. As a side effect, test_warnings started to complain with: Warning -- warnings.filters was modified by test_warnings The issue comes from the following function of

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread Eryk Sun
Eryk Sun added the comment: Virtual commands that are parsed to start with "python" are restricted to the list of installed versions of Python -- unless the virtual command allows searching and the Python command has no version specification (e.g.`#! /usr/bin/env python`). "python3" is

[issue24339] iso6937 encoding missing

2016-11-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think the encoder can just use codecs.charmap_encode(). The decoder seems could be simpler too. Would be nice to generate the ISO 6937 encoding file from external data (e.g. from glibc localedata) like they are generated for other encodings. Take

[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: INADA Naoki added the comment: > How about marking lookdict_unicode and lookdict_unicode_nodummy as hot? I don't understand well the effect of the hot attribute, so I suggest to run benchmarks and check that it has a non negligible effect on benchmarks ;-)

[issue22495] merge large parts of test_binop.py and test_fractions.py

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: > This requires quite a bit of work though for a relatively minor improvement > so do you think it's worth the effort ? If you factorize code of unit tests, I expect better tests and more tests, so yes, it's valuable. But since this issue is old (no activity

[issue28629] Emit ResourceWarning when implicitly terminating a suspended frame?

2016-11-14 Thread Nick Coghlan
Nick Coghlan added the comment: Oops, I forgot to mention one other potential cost-minimisation strategy for a `co_cleanuptab` field: only populate it with setup/cleanup opcode pairs that include a yield, yield from, or await operation between them. The potential benefit I can see to *not*

[issue24339] iso6937 encoding missing

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: iso6937.py: > # from utf-8 to iso6937 > def iso6937_encode(input,errors,encoding_map): Wait, is this code for Python 3? Decode from UTF-8 and encode to ISO-6937 in the same function seems strange to me. I expected that the codec only implements two

[issue28637] Python startup performance regression

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: The initial bug (performance regression in python_startup) is fixed. Thanks everyone for the nice discussion. I close the issue. Please open new issues if you want to continue efforts on making CPython faster ;-) -- resolution: -> fixed status: open

[issue24339] iso6937 encoding missing

2016-11-14 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Just as reference, here's the wikipedia page for the encoding: https://en.wikipedia.org/wiki/ISO/IEC_6937 and this is the ISO document (as preview): http://webstore.iec.ch/preview/info_isoiec6937%7Bed3.0%7Den.pdf (from the German wikipedia page).

[issue28637] Python startup performance regression

2016-11-14 Thread STINNER Victor
STINNER Victor added the comment: Ethan Furman: "Does this mean we can put enum back in re?" I checked manually: adding "import enum" to Lib/re.py has no more impact on "python_startup" benchmark. Guido van Rossum: "Honestly now the basic startup time is under control I am fine with

[issue28569] mock.attach_mock should work with any return value of patch()

2016-11-14 Thread Michael Foord
Michael Foord added the comment: Oh, I see what you mean - an attribute that doesn't exist on the original. With autospec that should throw an exception (AttributeError) I think, yes. -- ___ Python tracker

[issue28569] mock.attach_mock should work with any return value of patch()

2016-11-14 Thread Syed Suhail Ahmed
Syed Suhail Ahmed added the comment: But since autospec is set as True, then shouldnt attach_mock throw an exception when called with an attribute that doesn't exist? On Mon, Nov 14, 2016 at 5:12 PM, Michael Foord wrote: > > Michael Foord added the comment: > > It

[issue28569] mock.attach_mock should work with any return value of patch()

2016-11-14 Thread Michael Foord
Michael Foord added the comment: It should be perfectly valid to use attach_mock with an attribute that doesn't already exist. Part of it's purpose is to create new attributes. -- ___ Python tracker

[issue28082] re: convert re flags to (much friendlier) IntFlag constants

2016-11-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5fd69d4a93e0 by Victor Stinner in branch '3.6': Issue #28637: Reapply changeset 223731925d06 https://hg.python.org/cpython/rev/5fd69d4a93e0 New changeset be66786e95de by Victor Stinner in branch '3.6': Issue #28082: Add basic unit tests on re enums

[issue28637] Python startup performance regression

2016-11-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5fd69d4a93e0 by Victor Stinner in branch '3.6': Issue #28637: Reapply changeset 223731925d06 https://hg.python.org/cpython/rev/5fd69d4a93e0 -- ___ Python tracker

[issue28629] Emit ResourceWarning when implicitly terminating a suspended frame?

2016-11-14 Thread Nick Coghlan
Nick Coghlan added the comment: Martin raises an interesting point - the cases where ResourceWarning is likely to be appropriate are going to be those where the frame has been suspended inside a with statement or a try/finally statement. However, we don't currently track those at runtime or

[issue24459] Mention PYTHONFAULTHANDLER in the man page

2016-11-14 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the updated patch, Joshua. I will review and commit it this week. -- versions: +Python 3.7 ___ Python tracker

[issue28673] When using pyro4 with more than 15 threads, python 2.7.12 cores frequently

2016-11-14 Thread INADA Naoki
INADA Naoki added the comment: Traceback tells: #22 0x005a52db in PyInterpreterState_Clear (interp=0x95ac80) at ../Python/pystate.c:111 Py_CLEAR(interp->sysdict); While cleaning up interp->sysdict... #19 0x004d86c6 in tb_dealloc.46270 (tb=0x7f0aa1278f38) at

[issue27050] Demote run() below the high level APIs in subprocess docs

2016-11-14 Thread Nick Coghlan
Nick Coghlan added the comment: Indeed, further discussion showed that what they were after was something more along the lines of sarge.Capture: http://sarge.readthedocs.io/en/latest/overview.html#main-features That is, the ability to start the subprocess running in the background, and

[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-14 Thread INADA Naoki
INADA Naoki added the comment: How about marking lookdict_unicode and lookdict_unicode_nodummy as hot? -- nosy: +inada.naoki ___ Python tracker ___

  1   2   >