[issue45416] "loop argument must agree with lock" instantiating asyncio.Condition

2021-10-08 Thread Simon Willison
Simon Willison added the comment: It looks like the relevant test is here: https://github.com/python/cpython/blob/a1092f62492a3fcd6195bea94eccf8d5a300acb1/Lib/test/test_asyncio/test_locks.py#L722-L727 def test_explicit_lock(self): lock = asyncio.Lock() cond

[issue45416] "loop argument must agree with lock" instantiating asyncio.Condition

2021-10-08 Thread Simon Willison
Simon Willison added the comment: I ran across this issue while trying to use the https://pypi.org/project/janus/ locking library with Python 3.10 - see my issue on their tracker here: https://github.com/aio-libs/janus/issues/358 -- ___ Python

[issue45416] "loop argument must agree with lock" instantiating asyncio.Condition

2021-10-08 Thread Simon Willison
New submission from Simon Willison : In Python 3.10 it is not possible to instantiate an asyncio.Condition that wraps an asyncio.Lock without raising a "loop argument must agree with lock" exception. This code raises that exception: asyncio.Condition(asyncio.Lock()) T

[issue42783] asyncio.sleep(0) idiom is not documented

2020-12-29 Thread Simon Willison
Change by Simon Willison : -- keywords: +patch pull_requests: +22845 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24002 ___ Python tracker <https://bugs.python.org/issu

[issue42783] asyncio.sleep(0) idiom is not documented

2020-12-29 Thread Simon Willison
New submission from Simon Willison : asyncio.sleep(0) is the recommended idiom for co-operatively yielding control of the event loop to another task: https://github.com/python/asyncio/issues/284 and https://til.simonwillison.net/python/yielding-in-asyncio This isn't currently explained

[issue40562] SEO: differentiate between Python 2 and Python 3 docs on Google SERP

2020-05-08 Thread Simon Willison
Simon Willison added the comment: I asked about this on Twitter and got a couple of tips from Google engineers: https://twitter.com/simonw/status/1258767730263552000 It sounds like a good solution would be to explicitly design the breadcrumbs using this mechanism: https

[issue40562] SEO: differentiate between Python 2 and Python 3 docs on Google SERP

2020-05-08 Thread Simon Willison
New submission from Simon Willison : When I search Google for a Python related term (e.g. "sqlite3 row" - see attached screenshot) I get back two results - one for the Python 2 documentation and one for the Python 3 documentation. There is currently no indicator which result is

[issue39652] sqlite3 bug handling column names that contain square braces

2020-02-16 Thread Simon Willison
Simon Willison added the comment: Oh how interesting - yes it looks like this is deliberate behavior introduced in this commit: https://github.com/python/cpython/commit/0e3f591aeeef9ed715f8770320f4c4c7332a8794 -- ___ Python tracker <ht

[issue39652] sqlite3 bug handling column names that contain square braces

2020-02-16 Thread Simon Willison
Change by Simon Willison : -- type: -> behavior ___ Python tracker <https://bugs.python.org/issue39652> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue39652] sqlite3 bug handling column names that contain square braces

2020-02-16 Thread Simon Willison
New submission from Simon Willison : Bit of an obscure bug this one. SQLite allows column names to contain [ and ] characters, even though those are often used as delimiters in SQLite. Here's how to create such a database with bash: ``` sqlite3 /tmp/demo.db < In [5]: cursor.fetch

Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Simon Willison
= xml.sax.make_parser() UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 32: ordinal not in range(128) Is it possible to consume utf8 or unicode using xml.dom.pulldom or should I try something else? Thanks, Simon Willison -- http://mail.python.org/mailman/listinfo

Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Simon Willison
Follow up question: what's the best way of incrementally consuming XML in Python that's character encoding aware? I have a very large file to consume but I'd rather not have to fall back to the raw SAX API. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Simon Willison
On Jul 30, 4:43 pm, Paul Boddie [EMAIL PROTECTED] wrote: I can't reproduce this on Python 2.3.6 or 2.4.4 on RHEL 4. Instead, I get the usual... ('CHARACTERS', DOM Text node Simon\u2019s XM...) I'm using Python 2.5.1 on OS X Leopard: $ python Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13)

Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Simon Willison
On Jul 30, 4:59 pm, Simon Willison [EMAIL PROTECTED] wrote: I just tried it out on Python 2.4.2 on an Ubuntu machine and it worked fine! I guess this must be an OS X Python bug. How absolutely infuriating. Some very useful people in #python on Freenode pointed out that my bug occurs because

Treating a unicode string as latin-1

2008-01-03 Thread Simon Willison
? Thanks, Simon Willison -- http://mail.python.org/mailman/listinfo/python-list

Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Simon Willison
Hi all, I have an API design question. I'm writing a function that can either succeed or fail. Most of the time the code calling the function won't care about the reason for the failure, but very occasionally it will. I can see a number of ways of doing this, but none of them feel aesthetically

Re: CENSORSHIP - Django Project (Schema Evolution Support)

2006-06-07 Thread Simon Willison
Ilias Lazaridis wrote: [posted publicly to comp.lang.python, with email notification to 6 recipients relevant to the topic] I have implemented a simple schema evolution support for django, due to a need for a personal project. Additionally, I've provided an Audit: