[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber
Manuel Krebber added the comment: Alright, I added some tests and tried it again with the patch. -- Added file: http://bugs.python.org/file46427/slot-wrapper-types.patch ___ Python tracker

[issue29379] Custom handlers not used when passing "context" argument to urllib2.urlopen()

2017-01-26 Thread Martin Panter
Martin Panter added the comment: I presume this is the same as in Issue 18543 (and a few other duplicates). Let me know if I got it wrong. IMO there is no easy fix. The best solution may be to just document the behaviour as a limitation of the API, and design a new/improved API for the

[issue15769] urllib.request.urlopen with cafile or capath set overrides any previous Handlers

2017-01-26 Thread Martin Panter
Martin Panter added the comment: Nothing has been fixed; I don’t see any evidence that this is “out of date”. Here is a more complete test: import urllib.request opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor()) urllib.request.install_opener(opener) request =

[issue26355] Emit major version based canonical URLs for docs

2017-01-26 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: Here is a patch that add a canonical link to the current documentation that should apply cleanly to 3.4 and above. I can do similar for older versions. -- keywords: +patch Added file:

[issue25667] Supply dual-stack (IPv4/IPv6) socket bind routine

2017-01-26 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- versions: +Python 3.7 -Python 3.6 ___ Python tracker ___ ___

[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: > but an isinstance test seems pretty redundant. Tests are never redundant :-) Just add one-two asserts that you think should be true about issubclass and isinstance with these types (like self.assertIsInstance(''.__add__, types.MethodWrapperType)). String

[issue26355] Emit major version based canonical URLs for docs

2017-01-26 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: Does this have to be implemented on the doc build of EOL pythons versions (like 2.6), or can it be a script which is ran once on these old docs ? One of the issues I had trying to implement that on other projects was that you don't know in advance what

[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber
Manuel Krebber added the comment: I added some docs, but I am not sure what I would want to test here. There are no tests for types.BuiltinMethodType either. Maybe the string representation of it could be tested, but an isinstance test seems pretty redundant. I hope this patch file works

[issue23448] urllib2 needs to remove scope from IPv6 address when creating Host header

2017-01-26 Thread Jonathan Guthrie
Jonathan Guthrie added the comment: Michael Sweet's draft RFC requiring that the scope should be included in the Host line expired in May 2014 and I can't find where it ever went anywhere. Does anyone have any updated information? -- nosy: +JonathanGuthrie

[issue29375] httplib: wrong Host header when connecting to IPv6 link-local address

2017-01-26 Thread Jonathan Guthrie
Jonathan Guthrie added the comment: Yes, it is more closely related to Issue 23448. My search for related issues apparently wasn't exhaustive enough. -- ___ Python tracker

[issue13285] signal module ignores external signal changes

2017-01-26 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: Here is a proposal for an API: * getsignal: return the Python-level signal handler (this is an existing function) * setsignal: set the Python-level signal handler (but not the OS-level signal handler) * getossignal: get the OS-level signal handler as opaque

[issue29304] dict: simplify lookup function

2017-01-26 Thread INADA Naoki
INADA Naoki added the comment: dict-refactoring-3.patch: $ ../python.default -m perf compare_to default.json patched2.json -G --min-speed=2 Slower (7): - scimark_lu: 422 ms +- 35 ms -> 442 ms +- 11 ms: 1.05x slower (+5%) - logging_silent: 736 ns +- 7 ns -> 761 ns +- 21 ns: 1.03x slower (+3%) -

[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Manuel, thank you for a patch! Two comments: 1. Please produce your patch using Mercurial ``hg diff`` command, so that it could be recognized by review tool and merged easily. 2. Your patch should also include few tests (Lib/test/test_types.py) and

[issue29300] Modify the _struct module to use FASTCALL and Argument Clinic

2017-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It looks to me that the Py_buffer converter can be used for all the buffer parameter and special purposed converter can be used for the fmt parameter. -- ___ Python tracker

[issue29304] dict: simplify lookup function

2017-01-26 Thread INADA Naoki
INADA Naoki added the comment: > I think the patch should not be pushed without such analysis. Perhaps > Raymond will found a time to do this. Ok, I won't push until expert's LGTM. > One possible optimization is removing freeslot completely. because: > > * freeslot is used only when

[issue29300] Modify the _struct module to use FASTCALL and Argument Clinic

2017-01-26 Thread STINNER Victor
STINNER Victor added the comment: I reformatted docstrings, and wrote a summary line. -- ___ Python tracker ___

[issue29300] Modify the _struct module to use FASTCALL and Argument Clinic

2017-01-26 Thread STINNER Victor
STINNER Victor added the comment: Patch version 2 converts most functions and methods to Argument Clinic, except of unpack() and unpack_into() which require "*args" support in Argument Clinic: see the issue #20291. -- Added file:

[issue29379] Custom handlers not used when passing "context" argument to urllib2.urlopen()

2017-01-26 Thread Piotr Dobrogost
New submission from Piotr Dobrogost: When urllib2.urlopen() is passed "context" argument the new opener is being built (https://hg.python.org/cpython/file/a06454b1afa1/Lib/urllib2.py#l147) and used instead custom opener which might had been already installed with urllib2.install_opener().

[issue29378] Invalid example in documentation for PyErr_Fetch

2017-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The example looks correct to me. Could you please add more information? What example looks correct to you? -- nosy: +serhiy.storchaka ___ Python tracker

[issue29304] dict: simplify lookup function

2017-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I agreed that the duplication was made for reasons, but these reasons can be not valid or less weighty now, after a number of changes made last years like shared keys or compact dicts. An overhead of additional levels of indirection and complex code of

[issue29304] dict: simplify lookup function

2017-01-26 Thread INADA Naoki
INADA Naoki added the comment: BTW, perturb shift uses (i << 2) + i, instead of i*5. I feel it doesn't make sense in 21th century. I'll change it too. -- ___ Python tracker

[issue27727] Update Tools/freeze to use .vcxproj files

2017-01-26 Thread Kaeptm Blaubaer
Changes by Kaeptm Blaubaer : -- type: -> behavior ___ Python tracker ___ ___

[issue27727] Update Tools/freeze to use .vcxproj files

2017-01-26 Thread Kaeptm Blaubaer
Changes by Kaeptm Blaubaer : -- type: behavior -> ___ Python tracker ___ ___

[issue29378] Invalid example in documentation for PyErr_Fetch

2017-01-26 Thread Kaeptm Blaubaer
New submission from Kaeptm Blaubaer: In the example are the pointers to pointers to PyObject too many, because then PyErr_Fetch and PyErr_Restore would get too many pointers to pointers. -- assignee: docs@python components: Documentation messages: 286321 nosy: Kaeptm Blaubaer,

[issue29304] dict: simplify lookup function

2017-01-26 Thread INADA Naoki
INADA Naoki added the comment: Digging history, duplicated code is introduced here. (1997-01-17) https://github.com/python/cpython/commit/99304174680d4c724476dad300ae7fc638842bf0#diff-2131209d0deb0e50c93a88ec6c7b0d52 /* Optimizations based on observations by Jyrki Alakuijala

[issue26355] Emit major version based canonical URLs for docs

2017-01-26 Thread Nick Coghlan
Nick Coghlan added the comment: Belatedly following up on this, yeah, the RTFD page indicates that the header link should look like: http://docs.python.org/3/"> -- ___ Python tracker

[issue29368] Optimize unpickling list-like objects: use extend() instead of append()

2017-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Updated patch addresses Antoine's comment. It adds the comment explaining a fallback. -- Added file: http://bugs.python.org/file46421/pickle-appends-extend-2.patch ___ Python tracker

[issue29358] Add tp_fastnew and tp_fastinit to PyTypeObject, 15-20% faster object instanciation

2017-01-26 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka: > As for update_one_slot() see also issue5322 and issue25731. Oh, thanks for the pointers! Now I understand much better these bugs. I'm quite sure that they are still flaws in this code when a type is modified after PyType_Ready(), like

[issue29358] Add tp_fastnew and tp_fastinit to PyTypeObject, 15-20% faster object instanciation

2017-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: As for update_one_slot() see also issue5322 and issue25731. -- ___ Python tracker ___

[issue29358] Add tp_fastnew and tp_fastinit to PyTypeObject, 15-20% faster object instanciation

2017-01-26 Thread STINNER Victor
STINNER Victor added the comment: While they are obvious speedup on microbenchmarks, it doesn't speedup "macro" benchmarks from performance as much as I expected. The changes required in typeobject.c to support "tp_new or tp_fastnew" and "tp_init or tp_fastinit" are large and very complex.

[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-26 Thread STINNER Victor
STINNER Victor added the comment: "While I feel your work is great, performance benefit seems very small, compared complexity of this patch." I have to agree. I spent a lot of times on benhchmarking these tp_fast* changes. While one or two benchmarks are faster, it's not really the case for

[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-26 Thread INADA Naoki
INADA Naoki added the comment: While I feel your work is great, performance benefit seems very small, compared complexity of this patch. I think AST level optimize is more important. co_const and co_stacksize can be more small if constant folding is done in AST. And I think global cache

[issue28689] OpenSSL 1.1.0c test failures

2017-01-26 Thread Dima Tisnek
Dima Tisnek added the comment: 1.1.0d is due today. Who wants to test it? :) -- nosy: +Dima.Tisnek ___ Python tracker ___

[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber
Manuel Krebber added the comment: I would suggest the names SlotWrapperType and MethodWrapperType because I think they match their string representations the closest. For checking whether something is a method/function one could also use inspect.isroutine (or inspect.ismethoddescriptor), but

[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber
Changes by Manuel Krebber : -- keywords: +patch Added file: http://bugs.python.org/file46420/0001-Added-SlotWrapperType-and-MethodWrapperType-to-the-t.patch ___ Python tracker

[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-26 Thread Nick Coghlan
Nick Coghlan added the comment: The scrapy case looks to just be the new metaclass constraint that's already covered in the "Porting to Python 3.6" guide: https://github.com/scrapy/scrapy/pull/2509/files The ctypes case is more complicated, as its actually *reusing* the same class namespace

[issue29366] os.listdir has inconsistent behavior when run on a non-directory

2017-01-26 Thread Eryk Sun
Eryk Sun added the comment: > FindFirstFile naturally fails with ERROR_PATH_NOT_FOUND Getting this error actually depends on the file system. I don't see it with NTFS, which returns STATUS_NOT_A_DIRECTORY, which gets translated to ERROR_DIRECTORY. On the other hand, VboxSF (VirtualBox shared

[issue28518] execute("begin immediate") throwing OperationalError

2017-01-26 Thread Ma Lin
Ma Lin added the comment: You can set isolation_level = None in sqlite3.connect() parameters, then sqlite3 module will not begin a transaction implicitly. Another way is disabling auto-begin-transaction temporarily: sql.isolation_level = None sql.execute('VACUUM') sql.isolation_level = '' #

[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-26 Thread INADA Naoki
INADA Naoki added the comment: Another run at my machine. (tp_fastcall-6.patch) + ../python.default -m perf compare_to default.json patched.json -G --min-speed=2 Slower (8): - logging_silent: 736 ns +- 7 ns -> 783 ns +- 12 ns: 1.06x slower (+6%) - unpickle_pure_python: 829 us +- 13 us -> 875

[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Manuel, it would be helpful if you submit a patch. Guido, this is necessary for ``get_type_hints`` to work nicer with built-in methods, see https://github.com/python/typing/pull/368 -- nosy: +gvanrossum, levkivskyi versions: +Python 3.7

[issue17720] pickle.py's load_appends should call append() on objects other than lists

2017-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > From PEP 7: Sorry, I meant PEP 307 of course. -- ___ Python tracker ___

[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber
New submission from Manuel Krebber: There currently is no type in the types module for the slot wrappers/wrapper_descriptor types. I would like to have something like WrapperDescriptor = type(object.__init__) added to it (or maybe even add it to MethodType). This would be helpful to

[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-26 Thread STINNER Victor
STINNER Victor added the comment: tp_fastcall-6.patch: "call_method: 11.0 ms +- 0.3 ms -> 11.5 ms +- 0.5 ms: 1.05x slower (+5%)" I looked at the C code: the patch doesn't change any C function used by this benchmark. IHMO it's only a better of code locality. Maybe the PGO compilation

[issue23462] All os.exec*e variants crash on Windows

2017-01-26 Thread STINNER Victor
STINNER Victor added the comment: > Just hit that bug. Is this really not yet fixed in any newer version? The bug was fixed in Python 3.6.0. It was fixed by Steve Dower in its implementation of the PEP 529, in the change e20c7d8a8187: -execv(path_char, argvlist); +#ifdef HAVE_WEXECV +

[issue23462] All os.exec*e variants crash on Windows

2017-01-26 Thread Andreas Bergmeier
Andreas Bergmeier added the comment: Just hit that bug. Is this really not yet fixed in any newer version? -- nosy: +Andreas Bergmeier ___ Python tracker

[issue28518] execute("begin immediate") throwing OperationalError

2017-01-26 Thread Cédric Bellegarde
Cédric Bellegarde added the comment: Adding a commit doesn't fix the issue here: sql.commit() sql.execute('VACUUM') And on run: cannot VACUUM from within a transaction -- nosy: +Cédric Bellegarde ___ Python tracker

[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-26 Thread STINNER Victor
STINNER Victor added the comment: performance results on tp_fastcall-6.patch (diff >= 2%): --- haypo@speed-python$ python3 -m perf compare_to /home/haypo/benchmarks/2017-01-23_14-02-default-cebc9c7ad195.json tp_fastcall-6_ref_cebc9c7ad195.json -G --min-speed=2 Slower (6): -

[issue29328] struct module should support variable-length strings

2017-01-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: s/Where/Whether/ -- priority: normal -> low ___ Python tracker ___ ___

[issue29368] Optimize unpickling list-like objects: use extend() instead of append()

2017-01-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: This code looks correct and reasonable. The tests all pass for me. I think you can go forward and apply the patch. -- assignee: -> serhiy.storchaka nosy: +rhettinger ___ Python tracker

[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2017-01-26 Thread STINNER Victor
STINNER Victor added the comment: On Python 2, it's easy to workaround the issue, just always go the end explicitly: f = open(filename, "a+") f.seek(0, os.SEEK_END) Or use the io module which doesn't use the stdio of the C library and has a portable and reliable behaviour: f =