Staging
v0.5.1
https://github.com/python/cpython
Revision 3255e134fea656b8a142720fe7005204015c5781 authored by Amaury Forgeot d'Arc on 16 June 2008, 19:22:42 UTC, committed by Amaury Forgeot d'Arc on 16 June 2008, 19:22:42 UTC
seen after a "import multiprocessing.reduction"

An instance of a weakref subclass can have attributes.
If such a weakref holds the only strong reference to the object,
deleting the weakref will delete the object. In this case,
the callback must not be called, because the ref object is being deleted!

Backport of r34309
1 parent 75ee9eb
Raw File
Tip revision: 3255e134fea656b8a142720fe7005204015c5781 authored by Amaury Forgeot d'Arc on 16 June 2008, 19:22:42 UTC
Issue 3110: Crash with weakref subclass,
Tip revision: 3255e13
fmod.c

/* Portable fmod(x, y) implementation for systems that don't have it */

#include "pyconfig.h"

#include "pyport.h"
#include <errno.h>

double
fmod(double x, double y)
{
	double i, f;
	
	if (y == 0.0) {
		errno = EDOM;
		return 0.0;
	}
	
	/* return f such that x = i*y + f for some integer i
	   such that |f| < |y| and f has the same sign as x */
	
	i = floor(x/y);
	f = x - i*y;
	if ((x < 0.0) != (y < 0.0))
		f = f-y;
	return f;
}
back to top