Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

do not use xmlMemDisplayLast() when compiling in libxml2 2.6.x as it …

…was added in 2.7.0
  • Loading branch information...
commit 8afe96007986ea4602b9b60115b130c9c490d03d 1 parent 7b8fde4
scoder authored October 11, 2012
10  src/lxml/debug.pxi
@@ -42,7 +42,10 @@ cdef class _MemDebug:
42 42
         to the file ".memorylist" in the current directory.
43 43
 
44 44
         The optional parameter 'byte_count' limits the number of bytes in the dump.
  45
+        Note that this parameter is ignored when lxml is compiled against a libxml2
  46
+        version before 2.7.0.
45 47
         """
  48
+        cdef Py_ssize_t c_count
46 49
         if output_file is None:
47 50
             output_file = b'.memorylist'
48 51
         elif isinstance(output_file, unicode):
@@ -52,10 +55,13 @@ cdef class _MemDebug:
52 55
         if f is NULL:
53 56
             raise IOError("Failed to create file %s" % output_file.decode(sys.getfilesystemencoding()))
54 57
         try:
55  
-            if byte_count is None:
  58
+            if tree.LIBXML_VERSION < 20700:
  59
+                tree.xmlMemDisplay(f)
  60
+            elif byte_count is None:
56 61
                 tree.xmlMemDisplay(f)
57 62
             else:
58  
-                tree.xmlMemDisplayLast(f, byte_count)
  63
+                c_count = byte_count
  64
+                tree.xmlMemDisplayLast(f, c_count)
59 65
         finally:
60 66
             stdio.fclose(f)
61 67
 
1  src/lxml/includes/etree_defs.h
@@ -97,6 +97,7 @@
97 97
 #  define XML_PARSE_OLD10      1 << 17
98 98
 #  define XML_PARSE_NOBASEFIX  1 << 18
99 99
 #  define XML_PARSE_HUGE       1 << 19
  100
+#  define xmlMemDisplayLast(f,d)
100 101
 #endif
101 102
 
102 103
 #if LIBXML_VERSION < 20704

0 notes on commit 8afe960

Please sign in to comment.
Something went wrong with that request. Please try again.