[PATCHES] Build pytalloc for two Python versions at once, port to py3

Jelmer Vernooij jelmer at samba.org
Fri Mar 27 23:03:20 MDT 2015


On Tue, Mar 24, 2015 at 10:38:29AM +0100, Petr Viktorin wrote:
> On 03/19/2015 06:43 PM, Jelmer Vernooij wrote:
> >On Thu, Mar 19, 2015 at 04:07:24PM +0100, Petr Viktorin wrote:
Some quick comments on the test fixes:

> From d60bf9ca94b7d9e7a81537431e2443cd071e43e0 Mon Sep 17 00:00:00 2001
> From: Petr Viktorin <pviktori at redhat.com>
> Date: Fri, 6 Mar 2015 18:57:00 +0100
> Subject: [PATCH 01/15] pytalloc: Fix comparison of disparate types
> 
> When fed Python objects of different types, pytalloc_default_cmp
> compared pointers to PyType objects that weren't part of an array,
> resulting in undefined behavior.
> 
> This makes things a bit better (though it still casts ptrdiff_t to int).

Can you add a Signed-Off-By to this one?

> From ed161fb1f788c09c00364981f0c74f9425c0653a Mon Sep 17 00:00:00 2001
> From: Petr Viktorin <pviktori at redhat.com>
> Date: Thu, 5 Mar 2015 10:06:05 +0100
> Subject: [PATCH 03/15] pytalloc: Add tests
> 
> Add tests for pytalloc.
> 
> Since talloc objects can't be created from Python, a C extension
> with helpers is added.
> 
> Signed-off-by: Petr Viktorin <pviktori at redhat.com>
> ---
>  lib/talloc/test_pytalloc.c  | 120 ++++++++++++++++++++++++++++++++++++++++++++
>  lib/talloc/test_pytalloc.py | 109 ++++++++++++++++++++++++++++++++++++++++
>  lib/talloc/wscript          |  19 ++++++-
>  3 files changed, 247 insertions(+), 1 deletion(-)
>  create mode 100644 lib/talloc/test_pytalloc.c
>  create mode 100644 lib/talloc/test_pytalloc.py
> 
> diff --git a/lib/talloc/test_pytalloc.c b/lib/talloc/test_pytalloc.c
> new file mode 100644
> index 0000000..2d8372b
> --- /dev/null
> +++ b/lib/talloc/test_pytalloc.c
> @@ -0,0 +1,120 @@
> +/*
> +   Unix SMB/CIFS implementation.
> +   C utilities for the pytalloc test suite.
> +   Provides the "_test_pytalloc" Python module.
> +   Copyright (C) Petr Viktorin <pviktori at redhat.com> 2015
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
talloc is under the LGPL, please license your code under that license as well.

> +class TallocComparisonTests(unittest.TestCase):
> +    def test_compare_same(self):

^ Please add one newline after class definition - see PEP8.

Cheers,

Jelmer


More information about the samba-technical mailing list