[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-02-17 Thread Jonathan Slenders
Jonathan Slenders added the comment: The following patch to inspect.py solves the issue that inspect.signature() returns the wrong signature on classes that inherit from Generic. Not 100% sure though if this implementation is the cleanest way possible. I've been looking into attaching

[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2019-12-10 Thread Jonathan Slenders
Jonathan Slenders added the comment: Even simpler, the following code will crash after so many iterations: ``` import asyncio loop = asyncio.get_event_loop() while True: loop.call_soon_threadsafe(loop.stop) loop.run_forever() ``` Adding a little sleep of 0.01s after `run_forever

[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2019-12-10 Thread Jonathan Slenders
Jonathan Slenders added the comment: It looks like the following code will reproduce the issue: ``` import asyncio import threading loop = asyncio.get_event_loop() while True: def test(): loop.call_soon_threadsafe(loop.stop) threading.Thread(target=test).start

[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2019-12-10 Thread Jonathan Slenders
Jonathan Slenders added the comment: Thanks Victor for the reply. It looks like it's the self-socket in the BaseProactorEventLoop that gets closed. It's exactly this FD for which the exception is raised. We don't close the event loop anywhere. I also don't see `_close_self_pipe` being

[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2019-12-09 Thread Jonathan Slenders
Jonathan Slenders added the comment: Suppressing `ConnectionResetError` in `BaseProactorEventLoop._loop_self_reading`, like we do with `CancelledError` seems to fix it. Although I'm not sure what it causing the error, and whether we need to handle it somehow

[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2019-12-09 Thread Jonathan Slenders
New submission from Jonathan Slenders : We have a snippet of code that runs perfectly fine using the `SelectorEventLoop`, but crashes *sometimes* using the `ProactorEventLoop`. The traceback is the following. The exception cannot be caught within the asyncio application itself (e.g

[issue24536] os.pipe() should return a structsequence (or namedtuple.)

2015-06-30 Thread Jonathan Slenders
New submission from Jonathan Slenders: As discussed on python-ideas, os.pipe should return a structsequence instead of a plain tuple. To be decided is the naming for the read and write end. Personally, I'm in favour of using readfd/writefd. our_pipe = pipe() os.write(our_pipe.writefd

[issue24536] os.pipe() should return a structsequence (or namedtuple.)

2015-06-30 Thread Jonathan Slenders
Jonathan Slenders added the comment: Niki Spahiev made a valid argument saying that the following code is common: if not hasattr(src, 'read'): src = open(src) This will break if we name it 'read'/'write' like the methods of a file object

Why is array.array('u') deprecated?

2015-05-08 Thread jonathan . slenders
Why is array.array('u') deprecated? Will we get an alternative for a character array or mutable unicode string? Thanks! Jonathan -- https://mail.python.org/mailman/listinfo/python-list

Re: Why is array.array('u') deprecated?

2015-05-08 Thread jonathan . slenders
Le vendredi 8 mai 2015 12:29:15 UTC+2, Steven D'Aprano a écrit : On Fri, 8 May 2015 07:14 pm, jonathan.slenders wrote: Why is array.array('u') deprecated? Will we get an alternative for a character array or mutable unicode string? Good question. Of the three main encodings for

Re: Why is array.array('u') deprecated?

2015-05-08 Thread jonathan . slenders
Le vendredi 8 mai 2015 15:11:56 UTC+2, Peter Otten a écrit : So, this works perfectly fine and fast. But it scares me that it's deprecated and Python 4 will not support it anymore. Hm, this doesn't even work with Python 3: My mistake. I should have tested better. data = array.array(u,

Re: Why is array.array('u') deprecated?

2015-05-08 Thread jonathan . slenders
Can you expand a bit on how array(u) helps here? Are the matches in the gigabyte range? I have a string of unicode characters, e.g.: data = array.array('u', u'x' * 10) Then I need to change some data in the middle of this string, for instance: data[50] = 'y' Then I want to use

Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-08 Thread jonathan . slenders
Le mercredi 8 octobre 2014 01:40:11 UTC+2, MRAB a écrit : If you're not interested in generating an actual regex, but only in matching the prefix, then it sounds like you want partial matching. The regex module supports that: https://pypi.python.org/pypi/regex Wow, thanks a lot!

How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-07 Thread jonathan . slenders
Hi everyone, Probably I'm turning the use of regular expressions upside down with this question. I don't want to write a regex that matches prefixes of other strings, I know how to do that. I want to generate a regex -- given another regex --, that matches all possible strings that are a

Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-07 Thread jonathan . slenders
Logically, I'd think it should be possible by running the input string against the state machine that the given regex describes, and if at some point all the input characters are consumed, it's a match. (We don't have to run the regex until the end.) But I cannot find any library that

Re: Looking for a name for a deployment framework...

2013-06-25 Thread jonathan . slenders
Le mardi 25 juin 2013 06:38:44 UTC+2, Chris Rebert a écrit : Er, Salt is likewise written in Python. You're right. Salt is also Python, excuse me, and it's very powerful as well. -- http://mail.python.org/mailman/listinfo/python-list

Looking for a name for a deployment framework...

2013-06-24 Thread jonathan . slenders
Hi all, Any suggestions for a good name, for a framework that does automatic server deployments? It's like Fabric, but more powerful. It has some similarities with Puppet, Chef and Saltstack, but is written in Python. Key points are that it uses Python, but is still very declarative and

Re: Looking for a name for a deployment framework...

2013-06-24 Thread jonathan . slenders
Thanks everyone, I'll think about it. The main reason is that I'm working on the documentation, and this a a good opportunity to think about the naming. python-deploy-framework or python-deployer could be too boring. -- http://mail.python.org/mailman/listinfo/python-list