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

2020-11-19 Thread STINNER Victor


STINNER Victor  added the comment:

commit cc0cd43c0f96dac413e54855e9c77ec4b73bd2f8
Author: Christian Heimes 
Date:   Thu Nov 19 08:46:29 2020 +0100

bpo-1635741: Port _random to multiphase initialization (GH-23359)

See bpo-4 "Convert a few stdlib extensions to the limited C API".

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Py_Finalize() doesn't clear all Python objects at exit

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-06-22 Thread STINNER Victor


STINNER Victor  added the comment:

The PEP 384 part was fixed by:

commit 04f0bbfbedf8d2bb69b012f853de6648b1a9f27f
Author: Dino Viehland 
Date:   Fri Sep 13 11:12:27 2019 +0100

bpo-38075: Port _randommodule.c to PEP-384 (GH-15798)

- Migrate `Random_Type` to `PyType_FromSpec`
- To simulate an old use of `PyLong_Type.tp_as_number->nb_absolute`, I added
  code to the module init function to stash `int.__abs__` for later
  use. Ideally we'd use `PyType_GetSlot()` instead, but it doesn't currently
  work for static types in CPython, and implementing it just for this case
  doesn't seem worth it.
- Do exact check for long and dispatch to PyNumber_Absolute, use vector 
call when not exact.

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-05-13 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15668
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-11-08 Thread Robin Schreiber

Changes by Robin Schreiber robin.schrei...@me.com:


--
keywords: +pep3121 -patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15668
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-08-18 Thread Stefan Krah

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 rep...@bugs.python.org
http://bugs.python.org/issue15668
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-08-18 Thread Mark Dickinson

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 rep...@bugs.python.org
http://bugs.python.org/issue15668
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-08-18 Thread Mark Dickinson

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 rep...@bugs.python.org
http://bugs.python.org/issue15668
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-08-18 Thread Stefan Krah

Stefan Krah added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15668
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-08-17 Thread Martin v . Löwis

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 rep...@bugs.python.org
http://bugs.python.org/issue15668
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-08-15 Thread Robin Schreiber

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 rep...@bugs.python.org
http://bugs.python.org/issue15668
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-08-15 Thread Raymond Hettinger

Raymond Hettinger added the comment:

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

--
assignee:  - loewis
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15668
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com