[issue37658] In some cases asyncio.wait_for can lead to socket leak.

2021-05-24 Thread Denis S. Otkidach
Denis S. Otkidach added the comment: Re: msg393586 > See my comment in the PR for a suggestion about an alternative structure for > wait_for, which may avoid this gap and hence prevent the leak (but I have not > tested it!) Unfortunately this didn't close the gap, so the leak pers

[issue37658] In some cases asyncio.wait_for can lead to socket leak.

2021-05-13 Thread Denis S. Otkidach
Denis S. Otkidach added the comment: The original problem can be fixed by wrapping await into try-except block: ``` async def create_connection(ssl_obj): loop = asyncio.get_event_loop() connector = loop.create_connection(MyEchoClientProtocol, '127.0.0.1', 5000, ssl=ssl_obj

[issue42130] AsyncIO's wait_for can hide cancellation in a rare race condition

2021-05-13 Thread Denis S. Otkidach
Change by Denis S. Otkidach : -- keywords: +patch pull_requests: +24737 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26097 ___ Python tracker <https://bugs.python.org/issu

[issue37658] In some cases asyncio.wait_for can lead to socket leak.

2021-05-13 Thread Denis S. Otkidach
Change by Denis S. Otkidach : -- pull_requests: +24738 pull_request: https://github.com/python/cpython/pull/26097 ___ Python tracker <https://bugs.python.org/issue37

[issue37658] In some cases asyncio.wait_for can lead to socket leak.

2021-05-13 Thread Denis S. Otkidach
Denis S. Otkidach added the comment: The current solutions doesn't look correct. It swallows cancelling causing task to hang: https://bugs.python.org/issue42130 . Proposed test case calls cancel for inner future and set_result for outer task in the same loop step. The old (prior

[issue42130] AsyncIO's wait_for can hide cancellation in a rare race condition

2020-10-26 Thread Denis S. Otkidach
Change by Denis S. Otkidach : -- nosy: +ods ___ Python tracker <https://bugs.python.org/issue42130> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42140] asyncio.wait function creates futures set two times

2020-10-25 Thread Denis S. Otkidach
Denis S. Otkidach added the comment: The current error message is way too cryptic anyway. And restricting it to the set type only, as in docs, will certainly break a lot of code (passing a list is quite common). -- ___ Python tracker <ht

[issue42140] asyncio.wait function creates futures set two times

2020-10-24 Thread Denis S. Otkidach
Change by Denis S. Otkidach : -- nosy: +ods ___ Python tracker <https://bugs.python.org/issue42140> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36221] Setting PYTHONASYNCIODEBUG breaks warnings

2019-11-26 Thread Denis S. Otkidach
Denis S. Otkidach added the comment: It's fixed in 3.8 final, but the problem persists in 3.7.5 -- versions: -Python 3.8 ___ Python tracker <https://bugs.python.org/issue36

[issue34364] problem with traceback for syntax error in f-string

2019-05-28 Thread Denis S. Otkidach
Change by Denis S. Otkidach : -- nosy: +ods ___ Python tracker <https://bugs.python.org/issue34364> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37065] File and lineno is not reported for syntax error in f-string

2019-05-27 Thread Denis S. Otkidach
New submission from Denis S. Otkidach : Minimal example to reproduce: -->8-- >>> with open('f_bug.py', 'w') as fp: ... fp.write('f"{a b}"') ... 8 >>> import f_bug Traceback (most recent call last): File "", line 1, in File "", li

[issue36221] Setting PYTHONASYNCIODEBUG breaks warnings

2019-03-06 Thread Denis S. Otkidach
New submission from Denis S. Otkidach : Test script: -->8-- import asyncio @asyncio.coroutine def test(): with (yield from asyncio.Lock()): pass asyncio.run(test()) -->8-- Correct behavior without flag (warning is reported and points to correct line of code): --- $

[issue10935] wsgiref.handlers.BaseHandler and subclasses of str

2011-01-20 Thread Denis S. Otkidach
Denis S. Otkidach denis.otkid...@gmail.com added the comment: Phillip, your argument about interfacing with code written in C doesn't work for built-in immutable types like str. Any subclass of str must call str.__new__ thus keeping proper internal state

[issue10935] wsgiref.handlers.BaseHandler and subclasses of str

2011-01-19 Thread Denis S. Otkidach
Denis S. Otkidach denis.otkid...@gmail.com added the comment: Current behavior is unpythonic: documentation explicitly mentions isinstance as preferred way to check type (see http://docs.python.org/library/types.html ). Also 2.7 is the last minor version with str as main string type. So I

[issue5166] ElementTree and minidom don't prevent creation of not well-formed XML

2009-11-24 Thread Denis S. Otkidach
Denis S. Otkidach denis.otkid...@gmail.com added the comment: Here is a regexp I use to clean up text (note, that I don't touch compatibility characters that are also not recommended in XML; some other developers remove them too): # http://www.w3.org/TR/REC-xml/#NT-Char # Char ::= #x9 | #xA

[issue5166] ElementTree and minidom don't prevent creation of not well-formed XML

2009-06-25 Thread Denis S. Otkidach
Denis S. Otkidach denis.otkid...@gmail.com added the comment: Every blog engine I've even seen so far pass through comments from untrusted users to RSS/Atom feeds without proper validation causing broken XML in feeds. Sure, this is a bug in web applications, but DOM manipulation packages should

[issue1576598] ftplib doesn't follow standard

2009-03-30 Thread Denis S. Otkidach
Denis S. Otkidach denis.otkid...@gmail.com added the comment: Yes, it's a problem in Python library. I believe the patch proposed by Oleg in the issue821862 is the best solution to it. -- ___ Python tracker rep...@bugs.python.org http

[issue5166] ElementTree and minidom don't prevent creation of not well-formed XML

2009-02-06 Thread Denis S. Otkidach
New submission from Denis S. Otkidach denis.otkid...@gmail.com: ElementTree and minidom allow creation of not well-formed XML, that can't be parsed: from xml.etree import ElementTree element = ElementTree.Element('element') element.text = u'\0' xml = ElementTree.tostring(element, encoding

Job opportunity for Python developer in Moscow, Russia

2008-06-07 Thread Denis S. Otkidach
We are looking for Python experts with strong knowledge of web technologies, RDBMS, UNIX, object-oriented development. Experience in django, sqlalchemy, CORBA, memcached, jquery and development of scalable high-prefomance applications is a plus. Compensation is above the market. If you are

Re: python commmand line params from c++

2005-06-30 Thread Denis S. Otkidach
of it. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding Python - Deleting a class instance

2005-06-21 Thread Denis S. Otkidach
that the PyObject returned by PyInstance_New has refcount = 2, does this have any significance? The code below prints 1: PyObject *obj = PyInstance_New(PyExc_Exception, 0, 0); std::cerr obj-ob_refcnt \n; Does it create circular references in constructor? -- Denis S. Otkidach http://www.python.ru

Static (why?) PyDateTimeAPI and SIP

2005-06-18 Thread Denis S. Otkidach
used %End %PostInitialisationCode PyDateTime_IMPORT; %End But I wonder why PyDateTimeAPI is declared static, and is the a better solution? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to right align IPaddress?

2005-06-17 Thread Denis S. Otkidach
203.33.20.0 for ip in ('203.199.200.0', '203.33.20.0'): ... print '%15s' % ip ... 203.199.200.0 203.33.20.0 for ip in ('203.199.200.0', '203.33.20.0'): ... print ip.rjust(15) ... 203.199.200.0 203.33.20.0 -- Denis S. Otkidach http://www.python.ru/ [ru] -- http

Re: translating C++ exceptions to python

2005-06-14 Thread Denis S. Otkidach
(YourModule.YourException, 0, 0); 2. Add it to module dictionary. 3. In wrapper for my_cpp_function use something like the following code: try { my_cpp_function_impl(); } catch (YouException exc) { PyErr_SetString(YouExceptionClass, exc.what()); return 0; } -- Denis S. Otkidach http://www.python.ru

Re: deprecation of has_key?

2005-04-21 Thread Denis S. Otkidach
: assert item in d That's the reason why I always prefer to use has_key() and iteritems() to in and iter(). Readability counts. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: deprecation of has_key?

2005-04-21 Thread Denis S. Otkidach
and generally faster. For me dictionary is a collection of key-value pairs, but not a collection of keys (that's what set is). -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: Can an object of a C type have random members added? tp_dictoffset?

2005-04-21 Thread Denis S. Otkidach
; } PyObject_GC_Track(obj); return (PyObject *)obj; } PyTypeObject Your_Type = { PyObject_HEAD_INIT(PyType_Type) # ...skipped... offsetof(YourObject, dict), /* tp_dictoffset */ # ...skipped... } -- Denis S. Otkidach http://www.python.ru/ [ru] -- http

Re: PIL

2005-03-31 Thread Denis S. Otkidach
problems and solved them using some tricks with image.info['transparency'] and image.palette. Unfortunately I can't find this example, so if you succeed please post solution here. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: embedded python example: PyString_FromString doesnt work?

2005-03-25 Thread Denis S. Otkidach
directory as the executable DH so its not a path error or that kind of stuff. I believe you have to call Py_SetProgramName before Py_Initialize, or otherwise let Python know that it should look for modules in this directory. See http://python.org/doc/current/api/embedding.html#l2h-40 -- Denis S

Re: need help with nullmailer-inject in python cgi script to send attachements ?

2005-03-24 Thread Denis S. Otkidach
], stdin=PIPE) mailfl.stdin.write(msg.as_string()) mailfl.stdin.close() mailfl.wait() -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: setattr inside a module

2005-03-23 Thread Denis S. Otkidach
as first argument? globals()[name] = value or setattr(__import__(__name__), name, value) # note, circular import here -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Denis S. Otkidach
whether it's good idea to overload get() method, just an idea. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: bsddb for k, v in db.items(): do order the numbers ?

2005-03-02 Thread Denis S. Otkidach
integers you can pack keys with struct.pack('I', value). -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: re.compile and very specific searches

2005-02-19 Thread Denis S. Otkidach
not possibly be an IPv4 address). Can re.compile be configured to filter results like this out? Try this one: re.compile(r'\b%s\b' % r'\.'.join(['(?:(?:2[0-4]|1\d|[1-9])?\d|25[0-5])']*4)) -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to use the logging-module in a threadless environment?

2005-02-17 Thread Denis S. Otkidach
to something like: import dummy_thread as thread, dummy_threading as threading I believe it's a bug and logging/config.py should use the same approach as logging/__init__.py do: try: import thread import threading except ImportError: thread = None -- Denis S. Otkidach http

Re: sre is broken in SuSE 9.2

2005-02-12 Thread Denis S. Otkidach
. But isalpha behavior looks strange for me anyway: why cyrillic character '\u0430' is recognized as alpha one for de_DE locale, but is not for C? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: sre is broken in SuSE 9.2

2005-02-12 Thread Denis S. Otkidach
\xe4\u0430': print c.isalpha(), ... False False False False -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: sre is broken in SuSE 9.2

2005-02-11 Thread Denis S. Otkidach
doesn't matter if I don't call setlocale. Fortunately setting any non-C locale solves the problem for all (I believe) unicode character: re.compile(ur'\w+', re.U).findall(u'\xb5\xba\xe4\u0430') [u'\xb5\xba\xe4\u0430'] -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org

sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
+', re.U).match(u'\xe4') BTW, is correctly recognize this character as lowercase letter: import unicodedata unicodedata.category(u'\xe4') 'Ll' I've looked through all SuSE patches applied, but found nothing related. What is the reason for broken behavior? Incorrect configure options? -- Denis S

Re: sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
On Thu, 10 Feb 2005 13:00:42 +0300 Denis S. Otkidach [EMAIL PROTECTED] wrote: On all platfroms \w matches all unicode letters when used with flag re.UNICODE, but this doesn't work on SuSE 9.2: Python 2.3.4 (#1, Dec 17 2004, 19:56:48) [GCC 3.3.4 (pre 3.3.5 20040809)] on linux2 Type help

Re: sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
in their patches and the sources themselves are the same as on other platforms. I'd prefer to find the source of problem. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
On Thu, 10 Feb 2005 16:23:09 +0100 Daniel Dittmar [EMAIL PROTECTED] wrote: Denis S. Otkidach wrote: On all platfroms \w matches all unicode letters when used with flag re.UNICODE, but this doesn't work on SuSE 9.2: I think Python on SuSE 9.2 uses UCS4 for unicode strings (as does

Re: sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
BTW, where have they found something with Artistic License in Python? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on generator...

2005-01-21 Thread Denis S. Otkidach
in xrange(2, len(l)): ... for j in xrange(0, len(l)-i+1): ... yield l[j:j+i] ... list(consecutive_sets([1,2,3,4])) [[1, 2], [2, 3], [3, 4], [1, 2, 3], [2, 3, 4]] -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: os.spawnv stdin trouble

2005-01-12 Thread Denis S. Otkidach
usage with stdout redirected to file: out_fp = open('wall0.TRANS.rad', 'wb') subprocess.call(['c:\\Radiance\\bin\\xform.exe', '-t', '0', '8', '0', 'wallo.rad'], stdout=out_fp) -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman

Re: os.spawnv stdin trouble

2005-01-11 Thread Denis S. Otkidach
find file Don't understand how you got this error having syntax error and wrong path to executable. ##for your info I'm on win/xp, python 2.3.4 BTW, you are trying to redirect stdout. Wrong subject? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman

Re: DB-API format string conventions

2004-12-28 Thread Denis S. Otkidach
. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278612 -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb blob and binary data

2004-12-10 Thread Denis S. Otkidach
(fileobj=StringIO(data)).read() -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: Unknown locale nb_NO ?

2004-12-07 Thread Denis S. Otkidach
locale -a | grep nb_NO? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list