File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -217,12 +217,17 @@ PyObject *
217217_PyLong_Copy (PyLongObject  * src )
218218{
219219    assert (src  !=  NULL );
220+     int  sign ;
220221
221222    if  (_PyLong_IsCompact (src )) {
222223        stwodigits  ival  =  medium_value (src );
223224        if  (IS_SMALL_INT (ival )) {
224225            return  get_small_int ((sdigit )ival );
225226        }
227+         sign  =  _PyLong_CompactSign (src );
228+     }
229+     else  {
230+         sign  =  _PyLong_NonCompactSign (src );
226231    }
227232
228233    Py_ssize_t  size  =  _PyLong_DigitCount (src );
@@ -232,8 +237,9 @@ _PyLong_Copy(PyLongObject *src)
232237        PyErr_NoMemory ();
233238        return  NULL ;
234239    }
235-     _PyLong_SetSignAndDigitCount (result , _PyLong_Sign (src ), size );
236-     memcpy (result -> long_value .ob_digit , src -> long_value .ob_digit , size  *  sizeof (digit ));
240+     _PyLong_SetSignAndDigitCount (result , sign , size );
241+     memcpy (result -> long_value .ob_digit , src -> long_value .ob_digit ,
242+            size  *  sizeof (digit ));
237243    return  (PyObject  * )result ;
238244}
239245
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments