Re: [Python-Dev] Have problem when building python3.5.1 rpm with default SPEC file
> now that the SPEC file of fedora is open source, how about redhat's, how > could I get it? Fedora's spec files lives here: http://pkgs.fedoraproject.org/cgit/rpms/python3.git ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Update on the GitHub migration
The last blocker is updating issues on bugs.python.org when a commit is made that references an issue (Maciej is working on it, although as usual I'm sure help is welcome). Once that's in then it will be time to choose a date to stop commits and do the conversion. Once that's done it will be a bunch of little things to update due to the repo moving (e.g building the docs from git). ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Default formatting
On 25.10.16 12:37, Serhiy Storchaka wrote: Classes that doesn't define the __format__ method for custom PEP 3101 formatting inherits it from parents. Originally the object.__format__ method was designed as [1]: def __format__(self, format_spec): return format(str(self), format_spec) An instance is converted to string and resulting string is formatted according to format specifier. Later this design was reconsidered [2], and now object.__format__ is equivalent to: def __format__(self, format_spec): assert format_spec == '' return format(str(self), '') Non-empty format specifier is rejected. But why call format() on resulting string? Why not return resulting string as is? object.__format__ could be simpler (not just implementation, but for understanding): def __format__(self, format_spec): assert format_spec == '' return str(self) This can change the behaviour in corner case. str(self) can return not exact string, but string subclass with overloaded __format__. But I think we can ignore such subtle difference. [1] https://www.python.org/dev/peps/pep-3101/ [2] http://bugs.python.org/issue7994 What is the decision about this? ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] adding threaded tests to the test suite
Question: I need to add a threaded test to the enum test module [1] -- is there anything extra I need to worry about besides the test itself? Setting or resetting or using a tool library, etc? -- ~Ethan~ [1] The test to be added: def test_unique_composite(self): # override __eq__ to be identity only class TestFlag(IntFlag): one = auto() two = auto() three = auto() four = auto() five = auto() six = auto() seven = auto() eight = auto() def __eq__(self, other): return self is other def __hash__(self): return hash(self._value_) # have multiple threads competing to complete the composite members seen = set() failed = False def cycle_enum(): nonlocal failed try: for i in range(256): seen.add(TestFlag(i)) except (Exception, RuntimeError): failed = True threads = [] for i in range(8): threads.append(threading.Thread(target=cycle_enum)) for t in threads: t.start() for t in threads: t.join() # check that only 248 members were created self.assertFalse( failed, 'at least one thread failed while creating composite members') self.assertEqual(256, len(seen), 'too many composite members created') ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Default formatting
On 01/22/2017 11:48 AM, Serhiy Storchaka wrote: On 25.10.16 12:37, Serhiy Storchaka wrote: Classes that doesn't define the __format__ method for custom PEP 3101 formatting inherits it from parents. Originally the object.__format__ method was designed as [1]: def __format__(self, format_spec): return format(str(self), format_spec) An instance is converted to string and resulting string is formatted according to format specifier. Later this design was reconsidered [2], and now object.__format__ is equivalent to: def __format__(self, format_spec): assert format_spec == '' return format(str(self), '') Non-empty format specifier is rejected. But why call format() on resulting string? Why not return resulting string as is? object.__format__ could be simpler (not just implementation, but for understanding): def __format__(self, format_spec): assert format_spec == '' return str(self) This can change the behaviour in corner case. str(self) can return not exact string, but string subclass with overloaded __format__. But I think we can ignore such subtle difference. [1] https://www.python.org/dev/peps/pep-3101/ [2] http://bugs.python.org/issue7994 Can you give an example of this corner case? -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] adding threaded tests to the test suite
There is @support.reap_thread which can help. Victor Le dim. 22 janv. 2017 à 21:04, Ethan Furman a écrit : > Question: I need to add a threaded test to the enum test module [1] -- is > there anything extra I > > need to worry about besides the test itself? Setting or resetting or > using a tool library, etc? > > > > -- > > ~Ethan~ > > > > > > [1] The test to be added: > > > > def test_unique_composite(self): > > # override __eq__ to be identity only > > class TestFlag(IntFlag): > > one = auto() > > two = auto() > > three = auto() > > four = auto() > > five = auto() > > six = auto() > > seven = auto() > > eight = auto() > > def __eq__(self, other): > > return self is other > > def __hash__(self): > > return hash(self._value_) > > # have multiple threads competing to complete the composite > members > > seen = set() > > failed = False > > def cycle_enum(): > > nonlocal failed > > try: > > for i in range(256): > > seen.add(TestFlag(i)) > > except (Exception, RuntimeError): > > failed = True > > threads = [] > > for i in range(8): > > threads.append(threading.Thread(target=cycle_enum)) > > for t in threads: > > t.start() > > for t in threads: > > t.join() > > # check that only 248 members were created > > self.assertFalse( > > failed, > > 'at least one thread failed while creating composite > members') > > self.assertEqual(256, len(seen), 'too many composite members > created') > > ___ > > Python-Dev mailing list > > Python-Dev@python.org > > https://mail.python.org/mailman/listinfo/python-dev > > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/victor.stinner%40gmail.com > > ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] adding threaded tests to the test suite
> Le dim. 22 janv. 2017 à 21:04, Ethan Furman a écrit : >> Question: I need to add a threaded test to the enum test module [1] -- is >> there anything extra I >> need to worry about besides the test itself? Setting or resetting or >> using a tool library, etc? >> >> threads = [] >> for i in range(8): >> threads.append(threading.Thread(target=cycle_enum)) >> for t in threads: >> t.start() >> for t in threads: >> t.join() On 22 January 2017 at 20:17, Victor Stinner wrote: > There is @support.reap_thread which can help. As I understand, @reap_threads basically does a join() on each background thread, with a total timeout of 1 s. So since your test is unlikely to fail between starting threads and joining them, I don’t think you need to use @reap_threads. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] adding threaded tests to the test suite
On Sun, Jan 22, 2017 at 2:02 PM, Ethan Furman wrote: > Question: I need to add a threaded test to the enum test module [1] -- is > there anything extra I > need to worry about besides the test itself? Setting or resetting or using > a tool library, etc? As far as I know, the only extras to worry about are to use the support.reap_threads decorator, and be sure to skip the test if threading is not available. Search through the tests for 'reap_threads' if you want other examples of how to handle threaded tests. -- Zach ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] adding threaded tests to the test suite
On Sun, Jan 22, 2017 at 2:39 PM, Martin Panter wrote: > As I understand, @reap_threads basically does a join() on each > background thread, with a total timeout of 1 s. So since your test is > unlikely to fail between starting threads and joining them, I don’t > think you need to use @reap_threads. reap_threads is meant as a failsafe, in case your test case doesn't clean up after itself properly. Most of the time, reap_threads shouldn't actually *do* anything. -- Zach ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] adding threaded tests to the test suite
On 01/22/2017 12:02 PM, Ethan Furman wrote: Question: I need to add a threaded test to the enum test module [1] -- is there anything extra I need to worry about besides the test itself? Setting or resetting or using a tool library, etc? Thanks everyone. @support.reap_threads and skipping it is. -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] adding threaded tests to the test suite
On 22.01.17 22:02, Ethan Furman wrote: Question: I need to add a threaded test to the enum test module [1] -- is there anything extra I need to worry about besides the test itself? Setting or resetting or using a tool library, etc? You can use the test.support.start_threads() context manager. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Hello World
Hello World, I am a python developer that has lurked beyond my box. Nice to meet all of you'll. I'm excited to learn and hopefully contribute someday. Best Regards, Ramsey https://linkedin.com/in/ramseydsilva ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com