Commits

marcus  committed 00e6e3f

Added Python3.1 note.
Added overflow checks for SDL value types.

  • Participants
  • Parent commits 43eaa4c
  • Branches pgreloaded

Comments (0)

Files changed (9)

 installation. Additionally other libraries are needed, if you want to
 enable certain features of Pygame2.
 
-* Python 2.4, 2.5, 2.6, 3.0 supported   (http://www.python.org)
+* Python 2.4, 2.5, 2.6, 3.0, 3.1 supported   (http://www.python.org)
 
 [Optional dependencies]
 * SDL >= 1.2.10             (http://www.libsdl.org)

File doc/BuildDarwin.txt

 Make sure, you have at least one of the following Python versions installed:
 
 * Python 2.5 (bundled with Mac OS X)
-* Python 2.4, 2.6, 3.0 (http://www.python.org)
+* Python 2.4, 2.6, 3.0, 3.1 (http://www.python.org)
 
 These versions must be installed as Frameworks: Mac OS 10.5 already
 comes with Python 2.5 installed as a framework; be careful when

File doc/BuildMinGW.txt

 
 Make sure, you have at least one of the following Python versions installed:
 
-* Python 2.4, 2.5, 2.6, 3.0 (http://www.python.org)
+* Python 2.4, 2.5, 2.6, 3.0, 3.1 (http://www.python.org)
 
 To build anything, you will have to download the following additional source
 packages:

File doc/BuildUnix.txt

 
 Make sure, you have at least one of the following Python versions installed:
 
-* Python 2.4, 2.5, 2.6, 3.0 (http://www.python.org)
+* Python 2.4, 2.5, 2.6, 3.0, 3.1 (http://www.python.org)
 
 To build anything, you will have to download the following additional source
 packages:

File doc/BuildVC.txt

 Make sure, you have at least one of the following Python versions
 installed:
 
-* Python 2.4, 2.5, 2.6, 3.0 (http://www.python.org)
+* Python 2.4, 2.5, 2.6, 3.0, 3.1 (http://www.python.org)
 
 To build anything, you will have to download the following additional
 packages:

File examples/freetype/sdlfont.py

     fontdir = os.path.dirname (os.path.abspath (__file__))
     font = freetype.Font (os.path.join (fontdir, "sans.ttf"))
 
-    screen = video.set_mode (300, 200)
+    screen = video.set_mode (640, 480)
     screen.fill (colors["grey_light"])
 
     font.render("Hello World", colors["red"], None, screen, 32, 32, ptsize=64, style=ftconstants.STYLE_BOLD)

File src/physics/collision.c

         retval = NULL;
         goto back;
     }
+
     /* TODO: problem here! */
+    PyVector2_TransformMultiple (vertices1, inpos1, count1, pos2, rot2, pos1,
+        rot1);
     PyVector2_TransformMultiple (vertices2, inpos2, count2, pos1, rot1, pos2,
         rot2);
-    PyVector2_TransformMultiple (vertices1, inpos1, count1, pos2, rot2, pos1,
-        rot1);
-  
+
+/*
+    for (i = 0; i < count1; i++)
+    {
+        printf ("vertices1, %d: %.3f, %.3f\n", i, inpos1[i].real,
+            inpos1[i].imag);
+    }
+    puts ("---");
+    for (i = 0; i < count2; i++)
+    {
+        printf ("vertices2, %d: %.3f, %.3f\n", i, vertices2[i].real,
+            vertices2[i].imag);
+    }
+    puts ("---");
+*/
+
     if (!_clip_test (&box1, inpos2, count2, &collision))
     {
         retval = Py_None;
         goto back;
     }
 
-/*     if (AABBox_Contains (&box2, &vertices1[0], 0.f)) */
-/*         collision.contacts[collision.contact_size++] = rsh1->bottomleft; */
-/*     if (AABBox_Contains (&box2, &vertices1[1], 0.f)) */
-/*         collision.contacts[collision.contact_size++] = rsh1->bottomright; */
-/*     if (AABBox_Contains (&box2, &vertices1[2], 0.f)) */
-/*         collision.contacts[collision.contact_size++] = rsh1->topright; */
-/*     if (AABBox_Contains (&box2, &vertices1[3], 0.f)) */
-/*         collision.contacts[collision.contact_size++] = rsh1->topleft; */
+    puts ("DSA");
+    if (AABBox_Contains (&box2, &vertices1[0], 0.f))
+        collision.contacts[collision.contact_size++] = rsh1->bottomleft;
+    if (AABBox_Contains (&box2, &vertices1[1], 0.f))
+        collision.contacts[collision.contact_size++] = rsh1->bottomright;
+    if (AABBox_Contains (&box2, &vertices1[2], 0.f))
+        collision.contacts[collision.contact_size++] = rsh1->topright;
+    if (AABBox_Contains (&box2, &vertices1[3], 0.f))
+        collision.contacts[collision.contact_size++] = rsh1->topleft;
 
     _sat_collision (&pos1, rot1, &pos2, rot2, &box1, &box2, &collision);
 

File src/sdl/sdlmod.c

             PyErr_SetString (PyExc_ValueError, "value must not be negative");
             return 0;
         }
+        if (tmp > UCHAR_MAX)
+        {
+            PyErr_SetString (PyExc_ValueError, "value exceeds allowed range");
+            return 0;
+        }
         *val = (Uint8)tmp;
         return 1;
     }
             PyErr_SetString (PyExc_ValueError, "value must not be negative");
             return 0;
         }
+        if (tmp > USHRT_MAX)
+        {
+            PyErr_SetString (PyExc_ValueError, "value exceeds allowed range");
+            return 0;
+        }
         *val = (Uint16)tmp;
         return 1;
     }
         Py_DECREF (intobj);
         if (tmp == -1 && PyErr_Occurred ())
             return 0;
+        if (tmp > SHRT_MAX || tmp < SHRT_MIN)
+        {
+            PyErr_SetString (PyExc_ValueError, "value exceeds allowed range");
+            return 0;
+        }
         *val = (Sint16)tmp;
         return 1;
     }
         Py_DECREF (longobj);
         if (PyErr_Occurred ())
             return 0;
+        if (tmp > ULONG_MAX)
+        {
+            PyErr_SetString (PyExc_ValueError, "value exceeds allowed range");
+            return 0;
+        }
+
         *val = (Uint32)tmp;
         return 1;
     }

File test/util/gen_stubs.py

 for relpath in ('../../','../'):
     sys.path.insert(0, os.path.abspath(os.path.normpath(os.path.join \
         (os.path.dirname(__file__), relpath))))
-import test.pgunittest as unittest
+
+try:
+    import pygame2.test.pgunittest as unittest
+except:
+    import test.pgunittest as unittest
 
 if sys.version_info < (2, 5, 0):
     ismemberdescriptor = isdatadescriptor