[issue30011] HTMLParser class is not thread safe

2017-04-15 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bu

[issue30011] HTMLParser class is not thread safe

2017-04-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 50f948edda0e6465e194ecc50b85fa2646039b8d by Serhiy Storchaka in branch '2.7': bpo-30011: Fixed race condition in HTMLParser.unescape(). (#1140) https://github.com/python/cpython/commit/50f948edda0e6465e194ecc50b85fa2646039b8d -- _

[issue30011] HTMLParser class is not thread safe

2017-04-15 Thread Alessandro Vesely
Alessandro Vesely added the comment: Serhiy's analysis is correct. If anything more than a comment is going to make its way to the code, I'd suggest to move dictionary building to its own function, so that it can be called either on first use --like now-- or before threading if the user is conce

[issue30011] HTMLParser class is not thread safe

2017-04-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is nothing wrong with building entitydefs multiple times since the result is same. An alternative is using locking, but this is more cumbersome solution. And building entitydefs is much faster than importing the threading module. $ ./python -m timeit -

[issue30011] HTMLParser class is not thread safe

2017-04-14 Thread Alessandro Vesely
Alessandro Vesely added the comment: On Fri 14/Apr/2017 19:44:29 +0200 Serhiy Storchaka wrote: > > Changes by Serhiy Storchaka : > > > -- > pull_requests: +1272 Thank you for your fix, Serhiy. It makes the class behave consistently. However, busy processes are going to concurrently

[issue30011] HTMLParser class is not thread safe

2017-04-14 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1272 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue30011] HTMLParser class is not thread safe

2017-04-07 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- keywords: +easy nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue30011] HTMLParser class is not thread safe

2017-04-07 Thread Alessandro Vesely
New submission from Alessandro Vesely: SYMPTOM: When used in a multithreaded program, instances of a class derived from HTMLParser may convert an entity or leave it alone, in an apparently random fashion. CAUSE: The class has a static attribute, entitydefs, which, on first use, is initialized