There's no way to tell you that. Too many variables are involved. Use your senses to tell if it is spoiled. Check for off-odors, sliminess, mold and discoloration.
A carved pumpkin will last around a month. But it also depends on how much you have carved out. If you carve a lot out it will go rotten faster. But if you never carve anything out of the pumpkin it...
In theory: Quite some time. In fact: Canned food becomes more and more tasteless and unappetizing as it ages. In practice: Discard canned food past it's expiration date.