[issue30403] Running extension modules using -m switch

2017-05-25 Thread Stefan Behnel
Stefan Behnel added the comment: Thanks for bringing me in. The PoC implementation looks nice. Whether I'd like to support this in Cython? Absolutely. Requires some work, though, since Cython still doesn't implement PEP 489. But it shouldn't be hard, if I remember the discussions from back

[issue30365] Backport warnings in ElementTree/cElementTree modules and fix bugs

2017-05-14 Thread Stefan Behnel
Stefan Behnel added the comment: Looks good to me (didn't test it). Note that getchildren() is not deprecated in lxml because it's actually the fastest way to build a list of the children. It's faster than list(element) because it avoids the Python (C-level) iteration overhead. However

Re: Python Events in 2017, Need your help.

2017-02-10 Thread Stefan Behnel
Hi! Germany has three major Python events planned this year: - PyCon-Web in München (May 27-28th) - Python-Camp in Köln (April 8-9th) - PyCon-DE in Karlsruhe (October, dates TBA). http://pyconweb.org/ https://python-verband.org/informieren/events/pythoncamp-2017 Stefan Stephane Wirtel via

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread Stefan Behnel
Stefan Behnel added the comment: Thanks for asking. Cython doesn't use METH_FASTCALL yet, so this doesn't introduce any problems. Generally speaking, if Cython generated user code stops working with a new CPython version, we expect people to regenerate their code with the newest Cython

[issue29204] Add code deprecations in ElementTree

2017-01-08 Thread Stefan Behnel
Stefan Behnel added the comment: I'm ok with the deprecations. Regarding the cElementTree module, this is a bit problematic. The idiomatic import has lost its use in Py2.5 when ET and cET were added to the stdlib, so code that was written for Py2.5 or later (e.g. because it uses generators

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2017-01-08 Thread Stefan Behnel
Stefan Behnel added the comment: Actually, it seems that calling urlcleanup() is sufficient as a work-around. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2017-01-08 Thread Stefan Behnel
Stefan Behnel added the comment: This bug makes the installation of lxml fail on many systems (especially MacOS) when pip installs from sources, because it tries to download its library dependencies from FTP and crashes due to the FTP "error". I guess the current fix is to not

Re: windows utf8 & lxml

2016-12-26 Thread Stefan Behnel
Hi! Sayth Renshaw schrieb am 20.12.2016 um 12:53: > I have been trying to get a script to work on windows that works on mint. The > key blocker has been utf8 errors, most of which I have solved. > > Now however the last error I am trying to overcome, the solution appears to > be to use the

Re: Cython taking more time than regular Python

2016-09-19 Thread Stefan Behnel
Peter Otten schrieb am 19.09.2016 um 14:55: > In [7]: %%cython > def omega(int n): > cdef long i > cdef long result = 0 > for i in range(n): result += i > return result >...: > > In [8]: %timeit omega(10) > 1 loops, best of 3: 91.6 µs per loop Note that this is the

[issue27961] remove support for platforms without "long long"

2016-09-18 Thread Stefan Behnel
Stefan Behnel added the comment: Removing HAVE_LONG_LONG entirely causes breakage of third party code that uses this macro to enable PY_LONG_LONG support. Could you please always define it instead of removing it? -- nosy: +scoder ___ Python tracker

[issue17582] xml.etree.ElementTree does not preserve whitespaces in attributes

2016-09-12 Thread Stefan Behnel
Stefan Behnel added the comment: Raymond, you might have meant me when assigning the ticket and not Stefan Krah, but since I'm actually not a core dev, I can't commit the patch myself. See my last comment, though, I reviewed the patch and it should get committed

[issue27899] Apostrophe is not replace with ElementTree.tostring (also in Element.write)

2016-09-09 Thread Stefan Behnel
Stefan Behnel added the comment: Definitely not a bug since this isn't required by the XML spec. As said in issue 2647, you shouldn't rely on exact lexical characteristics of an XML byte stream, unless you request canonical serialisation (C14N

[issue19108] Benchmark runner tries to execute external Python command and fails on error reporting

2016-09-02 Thread Stefan Behnel
Stefan Behnel added the comment: Let's close this as outdated. New bugs for the new project should be reported in github anyway. -- resolution: -> out of date status: open -> closed ___ Python tracker <rep...@bugs.python.o

[issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding

2016-09-02 Thread Stefan Behnel
Stefan Behnel added the comment: > By the way, I'm surprised that the special encoding "unicode" relies on the > *current* locale encoding when the XML declaration is requested. That seems a weird choice. Since it serialises to a Unicode string, it shouldn't have any XML de

[issue22458] Add fractions benchmark

2016-09-02 Thread Stefan Behnel
Stefan Behnel added the comment: > So this benchmark cannot be used to show the superiority of exact fractions. I don't see how a benchmark would be a way to show that. It's certainly not the goal of this benchmark to show that one is computationally better than the other. But if a benchm

[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-09-01 Thread Stefan Behnel
Stefan Behnel added the comment: Looks like I forgot about this. My final fix still hasn't been applied, so the code in Py3.4+ is incorrect now. No, this cannot be tested from the Python level. -- ___ Python tracker <rep...@bugs.python.org>

[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2016-09-01 Thread Stefan Behnel
Stefan Behnel added the comment: I haven't seen any crashes in the wild here, but this is still the case in the latest code base. The change doesn't seem invasive, so I don't see why it shouldn't get implemented. -- nosy: +pitrou, scoder, serhiy.storchaka versions: +Python 3.5, Python

[issue22881] show median in benchmark results

2016-09-01 Thread Stefan Behnel
Changes by Stefan Behnel <sco...@users.sourceforge.net>: -- resolution: -> fixed status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.

Re: C Python extension to export an Function

2016-09-01 Thread Stefan Behnel
Ganesh Pal schrieb am 01.09.2016 um 17:24: > Thanks stefan and Gollwitzer , good to know there are many ways to do this > i.e via cython or SWIG but the C/Python API > is probably the most widely used method It certainly was, years ago, but I honestly doubt

[issue22458] Add fractions benchmark

2016-09-01 Thread Stefan Behnel
Stefan Behnel added the comment: Done: https://github.com/python/performance/pull/10 Note that I didn't replace the existing telco benchmark as it is more specific to Decimal. The new benchmark makes it possible to compare the decimal and fractions modules for similar operations, though

Re: C Python extension to export an Function

2016-09-01 Thread Stefan Behnel
Ganesh Pal schrieb am 01.09.2016 um 14:30: > On Thu, Sep 1, 2016 at 12:32 PM, dieter wrote: >> Ganesh Pal writes: >>> Iam pretty new to C Python extension , I was able to export few simple >>> modules to python and it look like the cool thing to do ... >> >> Maybe, it is a good idea to have a look

Re: Helloworld with Python C extension

2016-08-29 Thread Stefan Behnel
Ganesh Pal schrieb am 29.08.2016 um 19:30: > I need you input on the below hello world program. I a m trying to add a > python binding which will return the character for the given index . I am > on Python 2.7 and linux > > Example : > >>> string ='helloworld' > >>> dda_hello(5) > >>> 'w' >

[issue27841] Use fast call in method_call() and slot_tp_new()

2016-08-23 Thread Stefan Behnel
Stefan Behnel added the comment: If you care so much about C stack space, you could also try to create two or three entry point functions that keep (say) a 4, 8 and 16 items array on the stack respectively, and then pass the pointer (and the overall length if you need it) of that array

[issue27809] _PyObject_FastCall(): add support for keyword arguments

2016-08-22 Thread Stefan Behnel
Stefan Behnel added the comment: I just took a quick look at the fastcall_kwargs-2.patch for now. It looks ok in general, but it also adds quite some special code for the dict-to-locals mapping. Is the keyword argument calling case really that important? I mean, it requires creating a dict

[issue27809] _PyObject_FastCall(): add support for keyword arguments

2016-08-22 Thread Stefan Behnel
Stefan Behnel added the comment: I like the oneArg/noArg etc. macros. We use something similar in Cython. You can even use them to inline the METH_O and METH_NOARGS call cases (although I use inline functions for that in Cython). -- ___ Python

[issue27128] Add _PyObject_FastCall()

2016-08-22 Thread Stefan Behnel
Stefan Behnel added the comment: > What do you mean by "I copied your (no-kwargs) implementation"? I copied what you committed into CPython for _PyFunction_FastCall(): https://github.com/cython/cython/commit/8f3d3bd199a3d7f2a9fdfec0af57145b3ab363ca and then enabled its usag

[issue27128] Add _PyObject_FastCall()

2016-08-22 Thread Stefan Behnel
Stefan Behnel added the comment: FYI: I copied your (no-kwargs) implementation over into Cython and I get around 17% faster calls to Python functions with 2 positional arguments. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue27810] Add METH_FASTCALL: new calling convention for C functions

2016-08-22 Thread Stefan Behnel
Stefan Behnel added the comment: Extensive callback interfaces like map() come to mind, where a large number of calls becomes excessively time critical and might thus have made people implement their own special purpose calling code. However, I don't know any such code (outside of Cython

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Stefan Behnel
Stefan Behnel schrieb am 22.08.2016 um 08:03: > Steven D'Aprano schrieb am 22.08.2016 um 07:35: >> if sys.version < '3': >> import mymodule2 as mymodule >> else: >> import mymodule3 as mymodule > > This condition is going to fail when Python 30.0 come

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Stefan Behnel
Steven D'Aprano schrieb am 22.08.2016 um 07:35: > if sys.version < '3': > import mymodule2 as mymodule > else: > import mymodule3 as mymodule This condition is going to fail when Python 30.0 comes out. Stefan -- https://mail.python.org/mailman/listinfo/python-list

[issue27810] Add METH_FASTCALL: new calling convention for C functions

2016-08-21 Thread Stefan Behnel
Stefan Behnel added the comment: I agree that this would be cool. There is a tiny bit of a backwards compatibility concern as the new function signature would be incompatible with anything we had before, but I would guess that any code that chooses to bypass PyObject_Call() & friends w

[issue27810] Add METH_FASTCALL: new calling convention for C functions

2016-08-21 Thread Stefan Behnel
Changes by Stefan Behnel <sco...@users.sourceforge.net>: -- nosy: +scoder ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27810> ___

[issue27128] Add _PyObject_FastCall()

2016-08-21 Thread Stefan Behnel
Changes by Stefan Behnel <sco...@users.sourceforge.net>: -- nosy: +scoder ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27128> ___

[issue27818] Speed up number format spec parsing

2016-08-20 Thread Stefan Behnel
Stefan Behnel added the comment: You can easily see it by running timeit on fstrings, e.g. patched: $ ./python -m timeit 'f"{34276394612:15}"' 100 loops, best of 3: 0.352 usec per loop $ ./python -m timeit 'f"{34.276394612:8.6f}"' 100 loops, best of 3: 0.497 usec pe

[issue27818] Speed up number format spec parsing

2016-08-20 Thread Stefan Behnel
New submission from Stefan Behnel: I noticed that quite some time during number formatting is spent parsing the format spec. The attached patch speeds up float formatting by 5-15% and integer formatting by 20-30% for me overall when using f-strings (Ubuntu 16.04, 64bit). -- components

Re: usage of functools.partial in in parallelism

2016-07-31 Thread Stefan Behnel
Sivan Greenberg schrieb am 30.07.2016 um 23:15: > I'm wondering about the use of partial in writing parallel code. Is is it > quicker than re-evaluating arguments for a multiple session.get()'s method > with different , for example (of requests) ? > > Or maybe it is used to make sure the

[issue18304] ElementTree -- provide a way to ignore namespace in tags and seaches

2016-07-27 Thread Stefan Behnel
Stefan Behnel added the comment: On second thought, I think it should be supported (also?) in the parser. Otherwise, using it with an async parser would be different from (and more involved than) one-shot parsing. That seems wrong. -- ___ Python

[issue18304] ElementTree -- provide a way to ignore namespace in tags and seaches

2016-07-27 Thread Stefan Behnel
Stefan Behnel added the comment: Here is a proposed patch for a new function "strip_namespaces(tree)" that discards all namespaces from tags and attributes in a (sub-)tree, so that subsequent processing does not have to deal with them. The "__all__" test is failing (ha

Re: Quick poll: gmean or geometric_mean

2016-07-09 Thread Stefan Behnel
Ethan Furman schrieb am 09.07.2016 um 08:27: > On 07/08/2016 10:49 PM, Random832 wrote: >> On Sat, Jul 9, 2016, at 01:26, Steven D'Aprano wrote: > >>> hmean and gmean >>> >>> harmonic_mean and geometric_mean >> >> The latter, definitely. > > My preference is also for the latter. However, if the

Re: Which one is the best XML-parser?

2016-07-02 Thread Stefan Behnel
Random832 schrieb am 24.06.2016 um 15:09: > On Fri, Jun 24, 2016, at 02:39, dieter wrote: >> You want an incremental parser if the XML documents are so huge that >> you must process them incrementally rather than have a data structure >> representing the whole document (in memory). Incremental

[issue25455] Some repr implementations don't check for self-referential structures

2016-06-11 Thread Stefan Behnel
Stefan Behnel added the comment: Etree patch looks straight forward to me, feel free to apply it. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

Re: How are you supposed to define subclasses in C?

2016-04-21 Thread Stefan Behnel
Random832 schrieb am 21.04.2016 um 18:35: > I was trying to write a proof of concept on including descriptors (e.g. > a "sys.recursionlimit" instead of set/get methods) in the sys module, > and couldn't figure out how to "properly" define a type using > PyType_FromSpecWithBases. Everything I tried

Re: I'd like to add -march=native to my pip builds

2016-04-08 Thread Stefan Behnel
Neal Becker schrieb am 08.04.2016 um 15:27: > I'd like to add -march=native to my pip builds. How can I do this? First of all, make sure you don't install binary packages and wheels. Changing the C compiler flags will require source builds. Then, it should be enough to set the CFLAGS

[issue26519] Cython doesn't work anymore on Python 3.6

2016-03-19 Thread Stefan Behnel
Stefan Behnel added the comment: Our CI build server says it's all fine. The fix will eventually be released, certainly before Py3.6 comes out. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-03-19 Thread Stefan Behnel
Stefan Behnel added the comment: Ah, thanks. Here's my implementation then: https://github.com/cython/cython/pull/499/files It seems that tests for valid complex literals are missing. I've added these to the end of the list: '1_00_00.5j', '1_00_00.5e5', '1_00_00j

[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-03-19 Thread Stefan Behnel
Stefan Behnel added the comment: Nice one. While reimplementing it for Cython, I noticed that the grammar described in the PEP isn't exactly as it's implemented, though. The grammar says digit (["_"] digit)* whereas the latest patch (v4) says `digit` (`digit` | "

[issue24165] Free list for single-digits ints

2016-02-12 Thread Stefan Behnel
Stefan Behnel added the comment: I like Serhiy's patch, too, but it feels like the single-digit case should be enough. I found this comment by Yury a good argument: """ I can see improvements in micro benchmarks, but even more importantly, Serhiy's patch reduces memory frag

[issue22995] Restrict default pickleability

2016-01-16 Thread Stefan Behnel
Stefan Behnel added the comment: For reference, the bug in Cython is fixed here: https://github.com/cython/cython/commit/ececb3e9473f6aaa65f29467921594c316ec2f06 -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

Re: Writing SOME class methods in C

2015-11-29 Thread Stefan Behnel
Oscar Benjamin schrieb am 18.11.2015 um 13:52: > On 18 November 2015 at 07:50, Daniel Haude wrote: >> >> I'm trying to implement some (but not all) methods of a Python class in C. >> What I've found on the Net is: >> - how to implement entire modules in C so that I can import that module and >>

[issue25154] Drop the pyvenv script

2015-10-25 Thread Stefan Behnel
Stefan Behnel added the comment: May I ask how difficult it is for any of the core developers to fix a known typo in a Python source file? -- nosy: +scoder ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

Re: Create a .lua fle from Python

2015-10-02 Thread Stefan Behnel
jmp schrieb am 02.10.2015 um 11:03: > Safety is like speed optimization, you care about it only when it can be a > problem. And the vast majority (there's a recent trolling thread about the > equivalent percentage of vast majority if you want to have fun) of python > code may run on trusted

Re: The Nikola project is deprecating Python 2.7 (+2.x/3.x user survey results)

2015-10-01 Thread Stefan Behnel
Chris Warrick schrieb am 01.10.2015 um 18:26: > The Nikola developers decided to deprecate Python 2.7 support. I wonder why it took the Nikola project so long to take that decision. Python 3.3 came out almost exactly three(!) years ago and seems to have all major features that they would require.

[issue25047] xml.etree.ElementTree encoding declaration should be capital ('UTF-8') rather than lowercase ('utf-8')

2015-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: LGTM -- nosy: +scoder ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25047> ___ ___ Python-bugs-

[issue25147] Enum: remove dependency on OrderedDict

2015-09-18 Thread Stefan Behnel
Stefan Behnel added the comment: Let's say the change minimises the dependencies. That is a reasonable goal, too. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25150] 3.5: Include/pyatomic.h is incompatible with OpenMP (compilation of the third-party yt module fails on Python 3.5)

2015-09-18 Thread Stefan Behnel
Stefan Behnel added the comment: Would there be a way to expose these internals rather than hiding them? -- nosy: +scoder ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25150] 3.5: Include/pyatomic.h is incompatible with OpenMP (compilation of the third-party yt module fails on Python 3.5)

2015-09-18 Thread Stefan Behnel
Stefan Behnel added the comment: Understood and agreed. Second patch looks good to me. Cython calls PyThreadState_GET() in pretty much every helper function that deals with exceptions, but I doubt that the potential speed difference is going to be relevant in the real world. And we target

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Stefan Behnel
Stefan Behnel added the comment: > _collections sounds cool, but the flip side is any python without the C > implemntation would still have the slower startup, right? I wouldn't bother too much with that, certainly not given the order we are talking about here. Jython's startup time is

[issue25082] Editing What's New In Python 3.5

2015-09-13 Thread Stefan Behnel
Stefan Behnel added the comment: Thanks, Yury! -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25082> ___ ___ Python-bugs-list

[issue25082] Editing What's New In Python 3.5

2015-09-13 Thread Stefan Behnel
Stefan Behnel added the comment: Could I get a little note in the collections.abc section that the new ABCs "Generator", "Coroutine" and "Awaitable" are available as backports in the "backports_abc" package on PyPI? https://pypi.python.org/pypi/backpo

Re: XML Binding

2015-09-09 Thread Stefan Behnel
dieter schrieb am 09.09.2015 um 10:20: > Palpandi writes: >> Is it better to use pyxb than lxml? >> >> What are the advantages of lxml and pyxb? > > "pyxb" has a different aim than "lxml". > > "lxml" is a general purpose library to process XML documents. > It gives you an interface to the

[issue17582] xml.etree.ElementTree does not preserve whitespaces in attributes

2015-09-06 Thread Stefan Behnel
Stefan Behnel added the comment: Patch and test look correct. They fix a bug that produces incorrect output, so I vote for backporting them. Most code won't see the difference as whitespace control characters are rare in attribute values. And code that uses them will benefit from correctness

[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-06 Thread Stefan Behnel
Stefan Behnel added the comment: > The only thing that was a bit mystifying were the errors during the > initial profile run. There is so much that floats by in the terminal > window that I completely missed the warnings about errors during the > test run not being anything to

Re: Logging to a file from a C-extension

2015-08-26 Thread Stefan Behnel
Hi, welcome to Python (and to this list). The usual way to reply here is inline, after stripping anything that's not relevant to your reply. AllanPfalzgraf schrieb am 25.08.2015 um 15:03: From: Stefan Behnel: Al Pfalzgraf schrieb am 18.08.2015 um 15:07: If a logging file is opened

Re: how to handle cpu cache in python ( or fastest way to call a function once)

2015-08-23 Thread Stefan Behnel
Yuzhi Xu schrieb am 23.08.2015 um 08:10: I find out that python's VM seems to be very unfriendly with CPU-Cache. see: http://stackoverflow.com/questions/32163585/how-to-handle-cpu-cache-in-python-or-fastest-way-to-call-a-function-once

[issue17781] optimize compilation options

2015-08-22 Thread Stefan Behnel
Stefan Behnel added the comment: Issue 24915 suggests PGO and comes with an actual patch. I suggest rejecting this ticket as too broad. -- nosy: +scoder ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17781

[issue24915] Profile Guided Optimization active by-default

2015-08-22 Thread Stefan Behnel
Stefan Behnel added the comment: Please upload your patches as separate, uncompressed files for review. PGO was already proposed here, but nothing came out of it: https://bugs.python.org/issue17781 I suggest rejecting that old ticket and sticking with this one since it has an actual patch

Re: Logging to a file from a C-extension

2015-08-19 Thread Stefan Behnel
Al Pfalzgraf schrieb am 18.08.2015 um 15:07: If a logging file is opened at the level of a Python application, how would the log file name be communicated to a C-extension so that logging from the extension would be sent to the same log file? Writing to the file directly (as was suggested) may

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-08-18 Thread Stefan Behnel
Stefan Behnel added the comment: The can store arbitrary objects sentence is now duplicated, and still way too visible. I have to read three sentences until it tells me what I need to know. -- ___ Python tracker rep...@bugs.python.org http

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-08-18 Thread Stefan Behnel
Stefan Behnel added the comment: I think the first two sentences can simply be removed to fix this, without loss of readability or information. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24079

Re: Module load times

2015-08-13 Thread Stefan Behnel
Joseph L. Casale schrieb am 13.08.2015 um 18:56: I have an auto generated module that provides functions exported from a c dll. Its rather large and we are considering some dynamic code generation and caching, however before I embark on that I want to test import times. As the module is all

[issue24842] Mention SimpleNamespace in namedtuple docs

2015-08-11 Thread Stefan Behnel
Stefan Behnel added the comment: Also, the uptake for SNs are nearly zero. That suggests to me that pointing users to it could help. It's currently hidden in the types module and if I didn't know it existed, I could end up looking in collections, and failing to find it there, write my own

[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2015-08-03 Thread Stefan Behnel
Stefan Behnel added the comment: The fix wasn't applied yet, so the current code in 3.4 and later branches is still incorrect. Any of the last two patches (*_value) will fix it, with my preference on the last one. -- versions: +Python 3.6

[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2015-08-03 Thread Stefan Behnel
Stefan Behnel added the comment: Regarding tests, it looks like iteration isn't currently tested at the C level at all. At least, the xx test modules don't have any types that use it. I can write one up next week, or add it to one of the existing types (Xxo_Type?). Unlikely that I'll make

[issue24383] consider implementing __await__ on concurrent.futures.Future

2015-08-02 Thread Stefan Behnel
Stefan Behnel added the comment: It would be nice to have this applied to 3.5 even. I'm aware that this is a new feature that shouldn't go in any more at this point, but if it could get added in 3.5.1 at least, I think it would fill a rather clear and annoying gap when it comes to tool

[issue24383] consider implementing __await__ on concurrent.futures.Future

2015-08-02 Thread Stefan Behnel
Stefan Behnel added the comment: I find it questionable to mix await and threads, as I have said several times in the discussion about Nick Coghlan's proposal to introduce helper functions with a similar function. There are a couple of use cases in the context of asyncio, but definitely also

[issue24383] consider implementing __await__ on concurrent.futures.Future

2015-08-01 Thread Stefan Behnel
Stefan Behnel added the comment: Funny. I just thought about this yesterday and came up with pretty much the same idea. +1 for the patch. I don't think there are more classes to support here. Quite the contrary, other tools should try to integrate via concurrent.futures.Future instead

[issue24724] Element.findall documentation misleading

2015-07-31 Thread Stefan Behnel
Stefan Behnel added the comment: Whenever you feel a need for using range(len(...)), you are almost always doing something wrong. The problem in your code is that you are modifying the tree while iterating over it. However, please ask this question on the mailing list as the bug tracker

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-07-31 Thread Stefan Behnel
Stefan Behnel added the comment: could we apply this patch, please? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24079 ___ ___ Python-bugs

Re: New module (written in C) for using the high-precision QD library

2015-07-31 Thread Stefan Behnel
baruc...@gmail.com schrieb am 30.07.2015 um 22:09: It is written in pure C with the CPython C-API in order to get the highest possible speed. This is a common fallacy. Cython should still be able to squeeze another bit of performance out of your wrapper for you. It tends to know the C-API

[issue24724] Element.findall documentation misleading

2015-07-31 Thread Stefan Behnel
Stefan Behnel added the comment: Here's a complete drop-in replacement. More specific constraints on which elements to look for and where to look for them in the tree can be expressed in :ref:`XPath elementtree-xpath`. :meth:`Element.iterfind` iterates over all elements matching such a path

[issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

2015-07-31 Thread Stefan Behnel
Stefan Behnel added the comment: The proposed patch downplays that generality. That is completely intentional. Almost all readers of the documentation will first need to understand the difference between text and tail before they can go and think about any more advanced use cases

Re: New module (written in C) for using the high-precision QD library

2015-07-31 Thread Stefan Behnel
Chris Angelico schrieb am 31.07.2015 um 09:37: On Fri, Jul 31, 2015 at 5:26 PM, Stefan Behnel wrote: Your C code seems to be only about 1500 lines, not too late to translate it. That should save you a couple of hundred lines and at the same time make it work with Python 3 (which it currently

[issue24692] types.coroutines() idempotence documentation

2015-07-29 Thread Stefan Behnel
Stefan Behnel added the comment: Note that the expected usage is not as a function but as a decorator. That should be stated in the docs as well. IMHO, users should only do two things with whatever the result is: either use it as a Generator (as before), or pass it as an argument to await

[issue24697] Add CoroutineReturn and CoroutineExit builtin exceptions for coroutines

2015-07-23 Thread Stefan Behnel
Stefan Behnel added the comment: Hm, I think there's little need for new exceptions... While I agree with Yuri that the names are a bit awkward, I actually second this. The StopIteration is almost an implementation detail of how the return value is passed on to become the (Future) result

[issue24654] PEP 492 - example benchmark doesn't work (TypeError)

2015-07-18 Thread Stefan Behnel
Stefan Behnel added the comment: Thanks for updating the micro-benchmark. Just FYI (and sorry for hijacking this ticket), I ran it through Cython. Here are the numbers: Cython 0.23 (latest master) binary(21) * 3: total 1.609s abinary(21) * 3: total 1.514s CPython 3.5 (latest branch) binary(21

[issue23601] use small object allocator for dict key storage

2015-07-16 Thread Stefan Behnel
Stefan Behnel added the comment: Benchmark results look good to me (although a header line is missing) and seem to match my expectations. Sounds like we should allow this change. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

Re: Foo.__new__ is what species of method?

2015-07-14 Thread Stefan Behnel
Steven D'Aprano schrieb am 14.07.2015 um 06:54: On Tuesday 14 July 2015 14:45, Ben Finney wrote: The Python reference says of a class ‘__new__’ method:: object.__new__(cls[, ...]) Called to create a new instance of class cls. __new__() is a static method (special-cased so you

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Stefan Behnel
Stefan Behnel added the comment: Hmm, right. I see your point and also the analogy with yield. I could live with (maybe) giving it a better error message suggesting to use parentheses for clarity and otherwise keeping it a SyntaxError

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Stefan Behnel
Stefan Behnel added the comment: It looks like perfectly valid syntax to me and I cannot see why it should be semantically rejected. I disagree that it shouldn't be changed. I think it's a (minor) bug that should eventually get fixed. -- nosy: +scoder

[issue23601] use small object allocator for dict key storage

2015-07-10 Thread Stefan Behnel
Stefan Behnel added the comment: Your benchmarks are not affected by this change see the other issue. Then you ran them, I assume? Could you show the output here that you got? They are also not representative of every workload out there. Certainly not, but they do provide a certain variety

[issue14373] C implementation of functools.lru_cache

2015-07-10 Thread Stefan Behnel
Stefan Behnel added the comment: I'm witnessing a crash in the C implementation during garbage collection. Interestingly, it only shows in the Py3.6 branch, not in Py3.5 (both latest). Here's the gdb session: Program received signal SIGSEGV, Segmentation fault. lru_cache_tp_traverse (self

[issue14373] C implementation of functools.lru_cache

2015-07-10 Thread Stefan Behnel
Stefan Behnel added the comment: It's not actually my own code using the lru_cache here. From a quick grep over the code tree, the only potentially related usage I found was in Python's fnmatch module, on the _compile_pattern() function. Commenting that out then made the crash go away, so

[issue14373] C implementation of functools.lru_cache

2015-07-10 Thread Stefan Behnel
Stefan Behnel added the comment: test_fnmatch.py also passes, BTW. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14373 ___ ___ Python-bugs-list

[issue23601] use small object allocator for dict key storage

2015-07-09 Thread Stefan Behnel
Stefan Behnel added the comment: It's generally worth running the benchmark suite for this kind of optimisation. Being mostly Python code, it should benefit quite clearly from dictionary improvements, but it should also give an idea of how much of an improvement actual Python code

[issue24325] Speedup types.coroutine()

2015-07-03 Thread Stefan Behnel
Stefan Behnel added the comment: the undecorated form will never be visible to any code other than the decorator Assuming that 1) it's the first and/or only decorator, 2) it's used to decorate a generator function that returns its own generator and 3) it's really used as a decorator

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-07-03 Thread Stefan Behnel
Stefan Behnel added the comment: 1. abc.Coroutine and abc.Awaitable will guarantee that objects that implement them have '__await__' and it's safe to access it (that means that they will fail for generator-based coroutines). Absolutely. That was the main theme behind the whole type split

[issue24325] Speedup types.coroutine()

2015-07-03 Thread Stefan Behnel
Stefan Behnel added the comment: This is not purely about speeding up the code. It's also about avoiding to replace the code object of a function, which is essentially a big and clumsy hack only to achieve setting a flag. Some tools, namely line_profiler, use the current code object as a dict

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-29 Thread Stefan Behnel
Stefan Behnel added the comment: isawaitable(), however, should continue using abc.Awaitable, since it only checks for __await__ presence on the type (or should we just drop it?) I'd really remove it. It's not referring to an actual type, so it doesn't fit the purpose of the inspect module

Re: HOPE: A Python just-in-time compiler for astrophysical computations

2015-06-28 Thread Stefan Behnel
Michael Torrie schrieb am 26.06.2015 um 19:32: I've never heard of pythran; I'll have to check it out and see how it compares to the ever-growing crop of Python dialect compilers. My feeling is that Python seems such a simple language at the surface that people who want to write a special

Re: enumerate XML tags (keys that will become headers) along with text (values) and write to CSV in one row (as opposed to stacked values with one header)

2015-06-28 Thread Stefan Behnel
Denis McMahon schrieb am 26.06.2015 um 09:44: xml data is an unordered list, and are trying to assign an order to it. If the xml data was ordered, either each tag would be different, or each tag would have an attribute specifying a sequence number. XML is not unordered. The document order

<    2   3   4   5   6   7   8   9   10   11   >