File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -2264,20 +2264,19 @@ PyAPI_FUNC(int) PyUnstable_PerfMapState_Init(void) {
22642264 (intmax_t )pid );
22652265 int fd = open (filename , flags , 0600 );
22662266 if (fd == -1 ) {
2267- PyErr_SetFromErrnoWithFilename (PyExc_OSError , filename );
22682267 return -1 ;
22692268 }
22702269 else {
22712270 perf_map_state .perf_map = fdopen (fd , "a" );
22722271 if (perf_map_state .perf_map == NULL ) {
2273- PyErr_SetFromErrnoWithFilename ( PyExc_OSError , filename );
2272+ close ( fd );
22742273 return -1 ;
22752274 }
22762275 }
22772276 perf_map_state .map_lock = PyThread_allocate_lock ();
22782277 if (perf_map_state .map_lock == NULL ) {
2279- PyErr_SetString ( PyExc_RuntimeError , "failed to create a lock for perf-maps" );
2280- return -1 ;
2278+ fclose ( perf_map_state . perf_map );
2279+ return -2 ;
22812280 }
22822281#endif
22832282 return 0 ;
@@ -2290,7 +2289,7 @@ PyAPI_FUNC(int) PyUnstable_WritePerfMapEntry(
22902289) {
22912290#ifndef MS_WINDOWS
22922291 if (perf_map_state .perf_map == NULL ) {
2293- if (PyUnstable_PerfMapState_Init () == -1 ){
2292+ if (PyUnstable_PerfMapState_Init () != 0 ){
22942293 return -1 ;
22952294 }
22962295 }
You can’t perform that action at this time.
0 commit comments