Python3.0 has more duplication in source code than Python2.5

Terry terry.yinzhe at gmail.com
Sat Feb 7 08:36:07 EST 2009


On 2月7日, 下午7时10分, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> Terry schrieb:
>
> > On 2月7日, 下午3时36分, "Martin v. Löwis" <mar... at v.loewis.de> wrote:
> >>> Does that say something about the code quality of Python3.0?
> >> Not necessarily. IIUC, copying a single file with 2000 lines
> >> completely could already account for that increase.
>
> >> It would be interesting to see what specific files have gained
> >> large numbers of additional files, compared to 2.5.
>
> >> Regards,
> >> Martin
>
> > But the duplication are always not very big, from about 100 lines
> > (rare) to less the 5 lines. As you can see the Rate30 is much bigger
> > than Rate60, that means there are a lot of small duplications.
>
> Do you by any chance have a few examples of these? There is a lot of
> idiomatic code in python to e.g. acquire and release the GIL or doing
> refcount-stuff. If that happens to be done with rather generic names as
> arguments, I can well imagine that as being the cause.
>
> Diez

Example 1:
Found a 64 line (153 tokens) duplication in the following files:
Starting at line 73 of D:\DOWNLOADS\Python-3.0\Python\thread_pth.h
Starting at line 222 of D:\DOWNLOADS\Python-3.0\Python
\thread_pthread.h

	return (long) threadid;
#else
	return (long) *(long *) &threadid;
#endif
}

static void
do_PyThread_exit_thread(int no_cleanup)
{
	dprintf(("PyThread_exit_thread called\n"));
	if (!initialized) {
		if (no_cleanup)
			_exit(0);
		else
			exit(0);
	}
}

void
PyThread_exit_thread(void)
{
	do_PyThread_exit_thread(0);
}

void
PyThread__exit_thread(void)
{
	do_PyThread_exit_thread(1);
}

#ifndef NO_EXIT_PROG
static void
do_PyThread_exit_prog(int status, int no_cleanup)
{
	dprintf(("PyThread_exit_prog(%d) called\n", status));
	if (!initialized)
		if (no_cleanup)
			_exit(status);
		else
			exit(status);
}

void
PyThread_exit_prog(int status)
{
	do_PyThread_exit_prog(status, 0);
}

void
PyThread__exit_prog(int status)
{
	do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */

#ifdef USE_SEMAPHORES

/*
 * Lock support.
 */

PyThread_type_lock
PyThread_allocate_lock(void)
{




More information about the Python-list mailing list