Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue15668] PEP 3121, 384 Refactoring applied to random module

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Aug 15, 2012, 7:10 AM

Post #1 of 7 (119 views)
Permalink
[issue15668] PEP 3121, 384 Refactoring applied to random module

New submission from Robin Schreiber:

Changes proposed in PEP3121 and PEP384 have now been applied to the lsprof module!

----------
components: Extension Modules
files: _random_pep3121-384_v0.patch
keywords: patch
messages: 168297
nosy: Robin.Schreiber, rhettinger
priority: normal
severity: normal
status: open
title: PEP 3121, 384 Refactoring applied to random module
type: resource usage
versions: Python 3.4
Added file: http://bugs.python.org/file26828/_random_pep3121-384_v0.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15668>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 15, 2012, 7:25 AM

Post #2 of 7 (116 views)
Permalink
[issue15668] PEP 3121, 384 Refactoring applied to random module [In reply to]

Raymond Hettinger added the comment:

Martin, does this patch match your intent with PEP3121 and PEP384?

----------
assignee: -> loewis
nosy: +loewis

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15668>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 17, 2012, 1:24 AM

Post #3 of 7 (111 views)
Permalink
[issue15668] PEP 3121, 384 Refactoring applied to random module [In reply to]

Martin v. Löwis added the comment:

Sure; I've mentored Robin throughout the summer with this, and this is his GSoC project.

As for the specific change: this is primarily to support PEP 3121, and allowing multiple interpreters to use a module without fear of global variables being shared across interpreters.

In the current implementation, the Random type would be shared across all interpreters, with the change, each interpreter gets its own copy of the Random type. For that, the type needs to become a heap type, which is best done with the PEP 384 API (even though ABI stability is irrelevant for the random module).

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15668>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 18, 2012, 7:09 AM

Post #4 of 7 (110 views)
Permalink
[issue15668] PEP 3121, 384 Refactoring applied to random module [In reply to]

Stefan Krah added the comment:

I tried to benchmark this patch but I'm getting a segfault:

Python 3.3.0b2+ (default:dc18d73e67a5, Aug 18 2012, 15:37:04)
[GCC 4.4.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
Segmentation fault

----------
nosy: +skrah

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15668>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 18, 2012, 8:35 AM

Post #5 of 7 (110 views)
Permalink
[issue15668] PEP 3121, 384 Refactoring applied to random module [In reply to]

Mark Dickinson added the comment:

The Py_tp_bases line below doesn't look right. I suspect that's what's causing the segfault.


+static PyType_Slot Random_Type_slots[] = {
+ {Py_tp_getattro, PyObject_GenericGetAttr},
+ {Py_tp_doc, random_doc},
+ {Py_tp_methods, random_methods},
+ {Py_tp_new, random_new},
+ {Py_tp_free, PyObject_Free},
+ {Py_tp_bases, },
+ {0, 0}

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15668>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 18, 2012, 9:16 AM

Post #6 of 7 (110 views)
Permalink
[issue15668] PEP 3121, 384 Refactoring applied to random module [In reply to]

Mark Dickinson added the comment:

With the Py_tp_bases line removed, all tests pass for me on a non-debug 64-bit build on OS X 10.6. A quick timing of random.random() showed no distinguishable performance impact.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15668>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 18, 2012, 10:13 AM

Post #7 of 7 (110 views)
Permalink
[issue15668] PEP 3121, 384 Refactoring applied to random module [In reply to]

Stefan Krah added the comment:

Thanks, Mark. With your change applied I can't measure any performance
differences either.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15668>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.