File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -609,7 +609,7 @@ PyMODINIT_FUNC
609
609
PyInit_msvcrt (void )
610
610
{
611
611
int st ;
612
- PyObject * d , * version ;
612
+ PyObject * d ;
613
613
PyObject * m = PyModule_Create (& msvcrtmodule );
614
614
if (m == NULL )
615
615
return NULL ;
@@ -659,11 +659,16 @@ PyInit_msvcrt(void)
659
659
660
660
/* constants for the 2010 crt versions */
661
661
#if defined(_VC_CRT_MAJOR_VERSION ) && defined (_VC_CRT_MINOR_VERSION ) && defined(_VC_CRT_BUILD_VERSION ) && defined(_VC_CRT_RBUILD_VERSION )
662
- version = PyUnicode_FromFormat ("%d.%d.%d.%d" , _VC_CRT_MAJOR_VERSION ,
663
- _VC_CRT_MINOR_VERSION ,
664
- _VC_CRT_BUILD_VERSION ,
665
- _VC_CRT_RBUILD_VERSION );
666
- st = PyModule_AddObject (m , "CRT_ASSEMBLY_VERSION" , version );
662
+ PyObject * version = PyUnicode_FromFormat ("%d.%d.%d.%d" ,
663
+ _VC_CRT_MAJOR_VERSION ,
664
+ _VC_CRT_MINOR_VERSION ,
665
+ _VC_CRT_BUILD_VERSION ,
666
+ _VC_CRT_RBUILD_VERSION );
667
+ if (version == NULL ) {
668
+ return NULL ;
669
+ }
670
+ st = PyModule_AddObjectRef (m , "CRT_ASSEMBLY_VERSION" , version );
671
+ Py_DECREF (version );
667
672
if (st < 0 ) return NULL ;
668
673
#endif
669
674
/* make compiler warning quiet if st is unused */
You can’t perform that action at this time.
0 commit comments