This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年06月21日 22:39 by paul.moore, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (12) | |||
|---|---|---|---|
| msg108328 - (view) | Author: Paul Moore (paul.moore) * (Python committer) | Date: 2010年06月21日 22:39 | |
test_issue_8959_b fails when run from a service (in this case, from a buildslave running as a service). It appears to count the number of open windows, expecting a non-zero value. But when run as a service, it looks like the return count is (correctly) zero. FAIL: test_issue_8959_b (ctypes.test.test_callbacks.SampleCallbacksTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildslave\trunk.moore-windows\build\lib\ctypes\test\test_callbacks.py", line 208, in test_issue_8959_b self.assertFalse(windowCount == 0) AssertionError: True is not False |
|||
| msg108394 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2010年06月22日 15:41 | |
To test windows callbacks, I suggest to use EnumResourceTypes() instead, which is more likely to work in any condition: def test(): from ctypes.wintypes import BOOL, HMODULE, LONG, LPARAM import ctypes EnumResourceTypes = ctypes.windll.kernel32.EnumResourceTypesA EnumResTypeProc = ctypes.WINFUNCTYPE( BOOL, HMODULE, LONG, LPARAM) resource_types = [] def callback(hModule, typeid, lParam): resource_types.append(typeid) return True # keep enumerating hModule = None # Main executable RT_MANIFEST = 24 # from winuser.h EnumResourceTypes(hModule, EnumResTypeProc(callback), None) assert RT_MANIFEST in resource_types |
|||
| msg108412 - (view) | Author: Thomas Heller (theller) * (Python committer) | Date: 2010年06月22日 19:27 | |
> To test windows callbacks, I suggest to use EnumResourceTypes() > instead, which is more likely to work in any condition: Unfortunately the proposed test doesn't detect the problem in Python2.7 rc1. It runs without crashing, even if enumerating the resources in shell32.dll which contains a lot more stuff than python.exe. Maybe we should just remove the 'self.assertFalse()' call in the current test? |
|||
| msg112816 - (view) | Author: Paul Moore (paul.moore) * (Python committer) | Date: 2010年08月04日 14:54 | |
I'm not sure what needs to be done to move this forward, but as it's a problem with the test rather than with any actual code, could something be done to avoid masking real issues? I agree with Thomas that in the absence of any other solution, the assertFalse call should be removed pending a better answer. I can produce a patch, but it's pretty trivial and I'm away from my development PC for a few days, so it'll be a while before I get to it. |
|||
| msg113607 - (view) | Author: Tim Golden (tim.golden) * (Python committer) | Date: 2010年08月11日 16:00 | |
In the interests of moving this forward, I've committed the one-line removal of the assertion in r83948. Hopefully that will bring this buildbot back to life. |
|||
| msg113673 - (view) | Author: Tim Golden (tim.golden) * (Python committer) | Date: 2010年08月12日 12:23 | |
Fudge-fix committed as r83948, r83958. Not sure what status to set |
|||
| msg113675 - (view) | Author: Paul Moore (paul.moore) * (Python committer) | Date: 2010年08月12日 12:42 | |
Certainly the 2.7 branch on my buildbot is now OK (3.x is failing for other reasons :-() |
|||
| msg118348 - (view) | Author: Hirokazu Yamamoto (ocean-city) * (Python committer) | Date: 2010年10月11日 10:07 | |
Hello. I've been finding the way to determine whether the process is running as service or not. Does this way work? On my environment, True is returned. I hope False will be returned in service environment. http://msdn.microsoft.com/en-us/library/d56de412%28v=VS.80%29.aspx http://msdn.microsoft.com/en-us/library/ms683225%28VS.85%29.aspx ///////////////////////////////////////// from __future__ import print_function import ctypes from ctypes.wintypes import * UOI_FLAGS = 1 WSF_VISIBLE = 0x0001 class USEROBJECTFLAGS(ctypes.Structure): _fields_ = [("fInherit", BOOL), ("fReserved", BOOL), ("dwFlags", DWORD)] def window_station_has_display_surfaces(): dll = ctypes.windll.user32 h = dll.GetProcessWindowStation() if not h: raise ctypes.WinError() uof = USEROBJECTFLAGS() needed = DWORD() res = dll.GetUserObjectInformationW(h, UOI_FLAGS, ctypes.byref(uof), ctypes.sizeof(uof), ctypes.byref(needed)) if not res: raise ctypes.WinError() return bool(uof.dwFlags & WSF_VISIBLE) def main(): print(window_station_has_display_surfaces()) if __name__ == '__main__': main() |
|||
| msg118349 - (view) | Author: Hirokazu Yamamoto (ocean-city) * (Python committer) | Date: 2010年10月11日 10:10 | |
Oh, I forgot to mention this. I think it can be possible to disable "gui" resource on regrtest.py when this function returns False. (I hope #9931 also can be fixed by this) |
|||
| msg118350 - (view) | Author: Hirokazu Yamamoto (ocean-city) * (Python committer) | Date: 2010年10月11日 10:12 | |
I'm planning to try it on buildbot XP-5. |
|||
| msg118351 - (view) | Author: Hirokazu Yamamoto (ocean-city) * (Python committer) | Date: 2010年10月11日 10:52 | |
I confirmed window_station_has_display_surfaces() returned False on XP-5 which is running as service. See http://www.python.org/dev/buildbot/builders/x86%20XP-5%203.x/builds/1453/steps/test/logs/stdio (It ran r85362) |
|||
| msg222605 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2014年07月09日 07:36 | |
I think this can be closed as fixed/resolved, am I correct? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:02 | admin | set | github: 53301 |
| 2014年07月09日 07:57:33 | paul.moore | set | status: open -> closed resolution: fixed |
| 2014年07月09日 07:36:42 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages: + msg222605 |
| 2010年11月04日 13:44:30 | ocean-city | unlink | issue9931 dependencies |
| 2010年10月11日 10:52:54 | ocean-city | set | messages: + msg118351 |
| 2010年10月11日 10:49:00 | ocean-city | link | issue9931 dependencies |
| 2010年10月11日 10:12:27 | ocean-city | set | messages: + msg118350 |
| 2010年10月11日 10:10:37 | ocean-city | set | messages: + msg118349 |
| 2010年10月11日 10:07:39 | ocean-city | set | nosy:
+ ocean-city messages: + msg118348 |
| 2010年08月12日 12:42:33 | paul.moore | set | status: pending -> open messages: + msg113675 |
| 2010年08月12日 12:23:32 | tim.golden | set | status: open -> pending messages: + msg113673 |
| 2010年08月11日 16:00:57 | tim.golden | set | messages: + msg113607 |
| 2010年08月04日 15:00:06 | pitrou | set | nosy:
+ tim.golden, brian.curtin components: + Windows |
| 2010年08月04日 14:54:21 | paul.moore | set | messages: + msg112816 |
| 2010年06月22日 19:27:58 | theller | set | messages: + msg108412 |
| 2010年06月22日 15:41:57 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg108394 |
| 2010年06月21日 22:39:27 | paul.moore | create | |