New submission from Brad Larsen <b...@bradfordlarsen.com>:
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 } ---------- components: Extension Modules messages: 392949 nosy: blarsen, christian.heimes priority: normal severity: normal status: open title: Duplicated assignment in Modules/_randommodule.c versions: Python 3.10, Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44039> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com