➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author blarsen
Recipients blarsen, christian.heimes
Date 2021-05-04.20:46:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1620161161.27.0.458428568695.issue44039@roundup.psfhosted.org>
In-reply-to
Content
In Modules/_randommodule.c:600, `longval` is used in its own initialization.  This seems to be a typo introduced in commit cc0cd43c0f9 for bpo-1635741.

  585 static int
  586 _random_exec(PyObject *module)
  587 {
  588     _randomstate *state = get_random_state(module);
  589
  590     state->Random_Type = PyType_FromModuleAndSpec(
  591         module, &Random_Type_spec, NULL);
  592     if (state->Random_Type == NULL) {
  593         return -1;
  594     }
  595     if (PyModule_AddType(module, (PyTypeObject *)state->Random_Type) < 0) {
  596         return -1;
  597     }
  598
  599     /* Look up and save int.__abs__, which is needed in random_seed(). */
* 600     PyObject *longval = longval = PyLong_FromLong(0);
  601     if (longval == NULL) {
  602         return -1;
  603     }
  604
  605     PyObject *longtype = PyObject_Type(longval);
  606     Py_DECREF(longval);
  607     if (longtype == NULL) {
  608         return -1;
  609     }
  610
  611     state->Long___abs__ = PyObject_GetAttrString(longtype, "__abs__");
  612     Py_DECREF(longtype);
  613     if (state->Long___abs__ == NULL) {
  614         return -1;
  615     }
  616     return 0;
  617 }
History
Date User Action Args
2021-05-04 20:46:01blarsensetrecipients: + blarsen, christian.heimes
2021-05-04 20:46:01blarsensetmessageid: <1620161161.27.0.458428568695.issue44039@roundup.psfhosted.org>
2021-05-04 20:46:01blarsenlinkissue44039 messages
2021-05-04 20:46:00blarsencreate